当前位置: 首页>>代码示例>>Python>>正文


Python attribute_converter.to_local函数代码示例

本文整理汇总了Python中saml2.attribute_converter.to_local函数的典型用法代码示例。如果您正苦于以下问题:Python to_local函数的具体用法?Python to_local怎么用?Python to_local使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了to_local函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_filter_values_req_opt_4

def test_filter_values_req_opt_4():
    r = [
        Attribute(
            friendly_name="surName",
            name="urn:oid:2.5.4.4",
            name_format="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"),
        Attribute(
            friendly_name="givenName",
            name="urn:oid:2.5.4.42",
            name_format="urn:oasis:names:tc:SAML:2.0:attrname-format:uri")]
    o = [
        Attribute(
            friendly_name="title",
            name="urn:oid:2.5.4.12",
            name_format="urn:oasis:names:tc:SAML:2.0:attrname-format:uri")]

    acs = attribute_converter.ac_factory(full_path("attributemaps"))

    rava = attribute_converter.to_local(acs, r)
    oava = attribute_converter.to_local(acs, o)

    ava = {"sn": ["Hedberg"], "givenName": ["Roland"],
           "eduPersonAffiliation": ["staff"], "uid": ["rohe0002"]}

    ava = assertion.filter_on_demands(ava, rava, oava)
    print ava
    assert _eq(ava.keys(), ['givenName', 'sn'])
    assert ava == {'givenName': ['Roland'], 'sn': ['Hedberg']}
开发者ID:abec,项目名称:pysaml2,代码行数:28,代码来源:test_20_assertion.py

示例2: test_mixed_attributes_1

    def test_mixed_attributes_1(self):
        ats = saml.attribute_statement_from_string(STATEMENT_MIXED)
        ava = to_local(self.acs, ats)
        assert ava == {'eduPersonAffiliation': ['staff'],
                       'givenName': ['Roland'], 'sn': ['Hedberg'],
                       'uid': ['demouser'], 'user_id': ['bob']}

        # Allow unknown
        ava = to_local(self.acs, ats, True)
        assert ava == {'eduPersonAffiliation': ['staff'],
                       'givenName': ['Roland'], 'sn': ['Hedberg'],
                       'swissEduPersonHomeOrganizationType': ['others'],
                       'uid': ['demouser'], 'urn:example:com:foo': ['Thing'],
                       'user_id': ['bob']}
开发者ID:Itxaka,项目名称:pysaml2,代码行数:14,代码来源:test_19_attribute_converter.py

示例3: read_attribute_statement

    def read_attribute_statement(self, attr_statem):
        logger.debug("Attribute Statement: %s", attr_statem)
        # for aconv in self.attribute_converters:
        #    logger.debug("Converts name format: %s", aconv.name_format)

        self.decrypt_attributes(attr_statem)
        return to_local(self.attribute_converters, attr_statem, self.allow_unknown_attributes)
开发者ID:blenderbox,项目名称:pysaml2,代码行数:7,代码来源:response.py

示例4: test_mixed_attributes_1

    def test_mixed_attributes_1(self):
        ats = saml.attribute_statement_from_string(STATEMENT_MIXED)
        ava = to_local(self.acs, ats)
        assert ava == {
            "eduPersonAffiliation": ["staff"],
            "givenName": ["Roland"],
            "sn": ["Hedberg"],
            "uid": ["demouser"],
            "user_id": ["bob"],
        }

        # Allow unknown
        ava = to_local(self.acs, ats, True)
        assert ava == {
            "eduPersonAffiliation": ["staff"],
            "givenName": ["Roland"],
            "sn": ["Hedberg"],
            "swissEduPersonHomeOrganizationType": ["others"],
            "uid": ["demouser"],
            "urn:example:com:foo": ["Thing"],
            "user_id": ["bob"],
        }
开发者ID:blenderbox,项目名称:pysaml2,代码行数:22,代码来源:test_19_attribute_converter.py

示例5: test_to_local_name_from_unspecified

    def test_to_local_name_from_unspecified(self):
        _xml = """<?xml version='1.0' encoding='UTF-8'?>
        <ns0:AttributeStatement xmlns:ns0="urn:oasis:names:tc:SAML:2.0:assertion">
<ns0:Attribute
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    Name="EmailAddress"
    NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
    <ns0:AttributeValue xsi:type="xs:string">[email protected]</ns0:AttributeValue>
</ns0:Attribute></ns0:AttributeStatement>"""

        attr = attribute_statement_from_string(_xml)
        ava = attribute_converter.to_local(self.acs, attr)

        assert _eq(list(ava.keys()), ['EmailAddress'])
开发者ID:geops,项目名称:pysaml2,代码行数:14,代码来源:test_19_attribute_converter.py

示例6: get_identity

def get_identity(resp):
    """
    XXX taken from AuthnResponse - we need this for Artifact responses as well
    """
    if not resp.assertion.attribute_statement:
        logger.error("Missing Attribute Statement")
        ava = {}
    else:
        assert len(resp.assertion.attribute_statement) == 1
        _attr_statem = resp.assertion.attribute_statement[0]

        logger.debug("Attribute Statement: %s" % (_attr_statem,))
        for aconv in resp.attribute_converters:
            logger.info("Converts name format: %s" % (aconv.name_format,))

        ava = to_local(resp.attribute_converters, _attr_statem)
    return ava
开发者ID:Hackman238,项目名称:hl.pas.samlplugin,代码行数:17,代码来源:util.py

示例7: get_identity

    def get_identity(self):
        """ The assertion can contain zero or one attributeStatements

        """
        if not self.assertion.attribute_statement:
            logger.error("Missing Attribute Statement")
            ava = {}
        else:
            assert len(self.assertion.attribute_statement) == 1
            _attr_statem = self.assertion.attribute_statement[0]

            logger.debug("Attribute Statement: %s" % (_attr_statem,))
            for aconv in self.attribute_converters:
                logger.info("Converts name format: %s" % (aconv.name_format,))

            self.decrypt_attributes(_attr_statem)
            ava = to_local(self.attribute_converters, _attr_statem)
        return ava
开发者ID:taizo,项目名称:pysaml2,代码行数:18,代码来源:response.py

示例8: test_unspecified_name_format

 def test_unspecified_name_format(self):
     ats = saml.attribute_statement_from_string(STATEMENT4)
     ava = to_local(self.acs, ats)
     assert ava == {'user_id': ['bob'], 'NameID': ['bobsnameagain']}
开发者ID:Itxaka,项目名称:pysaml2,代码行数:4,代码来源:test_19_attribute_converter.py

示例9: attributes

 def attributes(self):
     return to_local(self.attribute_converters, self.message)
开发者ID:SpamapS,项目名称:pysaml2,代码行数:2,代码来源:request.py


注:本文中的saml2.attribute_converter.to_local函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。