本文整理汇总了Python中saml2.server.Server.create_logout_request方法的典型用法代码示例。如果您正苦于以下问题:Python Server.create_logout_request方法的具体用法?Python Server.create_logout_request怎么用?Python Server.create_logout_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类saml2.server.Server
的用法示例。
在下文中一共展示了Server.create_logout_request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_handle_logout_soap
# 需要导入模块: from saml2.server import Server [as 别名]
# 或者: from saml2.server.Server import create_logout_request [as 别名]
def test_handle_logout_soap():
sp = Saml2Client(config_file="servera_conf")
idp = Server(config_file="idp_all_conf")
policy = NameIDPolicy(format=NAMEID_FORMAT_TRANSIENT,
sp_name_qualifier=sp.config.entityid,
allow_create="true")
name_id = idp.ident.construct_nameid("subject", name_id_policy=policy)
binding, destination = idp.pick_binding("single_logout_service",
[BINDING_SOAP],
entity_id=sp.config.entityid)
rid, request = idp.create_logout_request(destination, idp.config.entityid,
name_id=name_id)
args = idp.apply_binding(BINDING_SOAP, "%s" % request, destination)
# register the user
session_info = {
"name_id": name_id, "issuer": idp.config.entityid,
"not_on_or_after": in_a_while(minutes=15),
"ava": {
"givenName": "Anders",
"surName": "Andersson",
"mail": "[email protected]"
}
}
sp.users.add_information_about_person(session_info)
reply_args = sp.handle_logout_request(args["data"], name_id, binding,
sign=False)
print(reply_args)
assert reply_args["method"] == "POST"
assert reply_args["headers"] == [('content-type', 'application/soap+xml')]
#if __name__ == "__main__":
# test_handle_logout_soap()