本文整理汇总了Python中saml2.assertion.filter_on_attributes函数的典型用法代码示例。如果您正苦于以下问题:Python filter_on_attributes函数的具体用法?Python filter_on_attributes怎么用?Python filter_on_attributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter_on_attributes函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_filter_on_attributes_with_missing_required_attribute
def test_filter_on_attributes_with_missing_required_attribute():
ava = {"extra": "foo"}
eptid = to_dict(Attribute(
friendly_name="eduPersonTargetedID", name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10",
name_format=NAME_FORMAT_URI), ONTS)
with pytest.raises(MissingValue):
filter_on_attributes(ava, required=[eptid])
开发者ID:Lefford,项目名称:pysaml2,代码行数:7,代码来源:test_20_assertion.py
示例2: test_filter_on_attributes_with_missing_optional_attribute
def test_filter_on_attributes_with_missing_optional_attribute():
ava = {"extra": "foo"}
eptid = to_dict(Attribute(
friendly_name="eduPersonTargetedID",
name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10",
name_format=NAME_FORMAT_URI), ONTS)
assert filter_on_attributes(ava, optional=[eptid], acs=ac_factory()) == {}
开发者ID:SUNET,项目名称:pysaml2,代码行数:7,代码来源:test_20_assertion.py
示例3: test_filter_values_req_opt_1
def test_filter_values_req_opt_1():
r = to_dict(
Attribute(
name="urn:oid:2.5.4.5",
name_format=NAME_FORMAT_URI,
friendly_name="serialNumber",
attribute_value=[AttributeValue(text="54321")],
),
ONTS,
)
o = to_dict(
Attribute(
name="urn:oid:2.5.4.5",
name_format=NAME_FORMAT_URI,
friendly_name="serialNumber",
attribute_value=[AttributeValue(text="12345"), AttributeValue(text="abcd0")],
),
ONTS,
)
ava = {"serialNumber": ["12345", "54321"]}
ava = filter_on_attributes(ava, [r], [o])
assert ava.keys() == ["serialNumber"]
assert _eq(ava["serialNumber"], ["12345", "54321"])
开发者ID:justquick,项目名称:pysaml2,代码行数:25,代码来源:test_20_assertion.py
示例4: test_filter_on_attributes_with_missing_name_format
def test_filter_on_attributes_with_missing_name_format():
ava = {"eduPersonTargetedID": "[email protected]",
"eduPersonAffiliation": "test",
"extra": "foo"}
eptid = to_dict(Attribute(friendly_name="eduPersonTargetedID",
name="urn:myown:eptid",
name_format=''), ONTS)
ava = filter_on_attributes(ava, optional=[eptid], acs=ac_factory())
assert ava['eduPersonTargetedID'] == "[email protected]"
开发者ID:SUNET,项目名称:pysaml2,代码行数:9,代码来源:test_20_assertion.py
示例5: test_filter_on_attributes_1
def test_filter_on_attributes_1():
a = to_dict(Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI, friendly_name="serialNumber"), ONTS)
required = [a]
ava = {"serialNumber": ["12345"], "givenName": ["Lars"]}
ava = filter_on_attributes(ava, required)
assert ava.keys() == ["serialNumber"]
assert ava["serialNumber"] == ["12345"]
开发者ID:justquick,项目名称:pysaml2,代码行数:9,代码来源:test_20_assertion.py
示例6: test_filter_on_attributes_0
def test_filter_on_attributes_0():
a = Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI,
friendly_name="serialNumber")
required = [a]
ava = { "serialNumber": ["12345"]}
ava = filter_on_attributes(ava, required)
assert ava.keys() == ["serialNumber"]
assert ava["serialNumber"] == ["12345"]
开发者ID:evansd,项目名称:pysaml2,代码行数:10,代码来源:test_20_assertion.py
示例7: test_filter_on_attributes_2
def test_filter_on_attributes_2():
a = to_dict(Attribute(friendly_name="surName",name="urn:oid:2.5.4.4",
name_format=NAME_FORMAT_URI), ONTS)
required = [a]
ava = {"sn":["kakavas"]}
ava = filter_on_attributes(ava,required,acs=ac_factory())
assert list(ava.keys()) == ['sn']
assert ava["sn"] == ["kakavas"]
开发者ID:SUNET,项目名称:pysaml2,代码行数:10,代码来源:test_20_assertion.py
示例8: test_filter_on_attributes_0
def test_filter_on_attributes_0():
a = to_dict(Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI,
friendly_name="serialNumber"), ONTS)
required = [a]
ava = {"serialNumber": ["12345"]}
ava = filter_on_attributes(ava, required, acs=ac_factory())
assert list(ava.keys()) == ["serialNumber"]
assert ava["serialNumber"] == ["12345"]
开发者ID:SUNET,项目名称:pysaml2,代码行数:10,代码来源:test_20_assertion.py
示例9: test_filter_values_req_6
def test_filter_values_req_6():
a = Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI,
friendly_name="serialNumber", attribute_value=[
AttributeValue(text="54321")])
required = [a]
ava = { "serialNumber": ["12345", "54321"]}
ava = filter_on_attributes(ava, required)
assert ava.keys() == ["serialNumber"]
assert ava["serialNumber"] == ["54321"]
开发者ID:evansd,项目名称:pysaml2,代码行数:11,代码来源:test_20_assertion.py
示例10: test_filter_on_attributes_without_friendly_name
def test_filter_on_attributes_without_friendly_name():
ava = {"eduPersonTargetedID": "[email protected]", "eduPersonAffiliation": "test",
"extra": "foo"}
eptid = to_dict(
Attribute(name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10", name_format=NAME_FORMAT_URI), ONTS)
ep_affiliation = to_dict(
Attribute(name="urn:oid:1.3.6.1.4.1.5923.1.1.1.1", name_format=NAME_FORMAT_URI), ONTS)
restricted_ava = filter_on_attributes(ava, required=[eptid], optional=[ep_affiliation],
acs=ac_factory())
assert restricted_ava == {"eduPersonTargetedID": "[email protected]",
"eduPersonAffiliation": "test"}
开发者ID:Lefford,项目名称:pysaml2,代码行数:12,代码来源:test_20_assertion.py
示例11: test_filter_values_req_opt_0
def test_filter_values_req_opt_0():
r = to_dict(
Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI,
friendly_name="serialNumber",
attribute_value=[AttributeValue(text="54321")]), ONTS)
o = to_dict(
Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI,
friendly_name="serialNumber",
attribute_value=[AttributeValue(text="12345")]), ONTS)
ava = {"serialNumber": ["12345", "54321"]}
ava = filter_on_attributes(ava, [r], [o], acs=ac_factory())
assert list(ava.keys()) == ["serialNumber"]
assert _eq(ava["serialNumber"], ["12345", "54321"])
开发者ID:SUNET,项目名称:pysaml2,代码行数:15,代码来源:test_20_assertion.py
注:本文中的saml2.assertion.filter_on_attributes函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论