【发布时间】:2020-05-16 09:54:19
【问题描述】:
我很难理解如何配置 pysaml2 并在我的请求中添加 AuthnContext。 我有一个 SP,我需要在客户端执行登录请求时添加以下请求:
<samlp:RequestedAuthnContext>
<saml:AuthnContextClassRef>
urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
</saml:AuthnContextClassRef>
</samlp:RequestedAuthnContext>
我很挣扎,因为我尽我所能,我相信可以在我的请求中添加它,因为在这里https://github.com/IdentityPython/pysaml2/blob/master/src/saml2/samlp.py
我可以看到:
AUTHN_PASSWORD = "urn:oasis:names:tc:SAML:2.0:ac:classes:Password"
AUTHN_PASSWORD_PROTECTED = \
"urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
我只是不知道如何引用它。我有一个像这样的简单配置:
"service": {
"sp": {
"name": "BLABLA",
"allow_unsolicited": true,
"want_response_signed": false,
"logout_requests_signed": true,
"endpoints": {
"assertion_consumer_service": ["https://mywebste..."],
"single_logout_service": [["https://mywebste...", "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"]]
},
"requestedAuthnContext" : true
}
}
有人知道如何添加上述配置吗? 即使通过阅读他们的文档,我也很难理解如何构建配置字典。有任何想法吗? 如果配置不允许,我很乐意直接在代码中添加“PasswordProtectedTransport”。但我不知道该怎么做。
谢谢, 回复
【问题讨论】:
-
伙计们,我解决了我的问题。还是谢谢。
-
如果您也可以发布解决方案会很棒