|
7 | 7 |
|
8 | 8 | from saml2 import BINDING_HTTP_REDIRECT, BINDING_SOAP, BINDING_HTTP_POST |
9 | 9 | from saml2.config import SPConfig, IdPConfig, Config |
10 | | - |
| 10 | +from saml2.saml import AUTHN_PASSWORD_PROTECTED, AuthnContextClassRef |
| 11 | +from saml2.samlp import RequestedAuthnContext |
11 | 12 | from saml2 import logger |
12 | 13 |
|
13 | 14 | from pathutils import dotname, full_path |
|
26 | 27 | "urn:mace:example.com:saml:roland:idp": { |
27 | 28 | 'single_sign_on_service': |
28 | 29 | {'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect': |
29 | | - 'http://localhost:8088/sso/'}}, |
30 | | - } |
| 30 | + 'http://localhost:8088/sso/'}}, |
| 31 | + }, |
| 32 | + "requested_authn_context": RequestedAuthnContext( |
| 33 | + authn_context_class_ref=[ |
| 34 | + AuthnContextClassRef(AUTHN_PASSWORD_PROTECTED), |
| 35 | + ], |
| 36 | + comparison="exact", |
| 37 | + ), |
31 | 38 | } |
32 | 39 | }, |
33 | 40 | "key_file": full_path("test.key"), |
@@ -217,6 +224,12 @@ def test_1(): |
217 | 224 | 'http://localhost:8088/sso/'}}] |
218 | 225 |
|
219 | 226 | assert c.only_use_keys_in_metadata |
| 227 | + assert c._sp_requested_authn_context.to_string().decode() == ( |
| 228 | + '<ns0:RequestedAuthnContext xmlns:ns0="urn:oasis:names:tc:SAML:2.0:protocol" ' |
| 229 | + 'xmlns:ns1="urn:oasis:names:tc:SAML:2.0:assertion" Comparison="exact">' |
| 230 | + '<ns1:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:' |
| 231 | + 'PasswordProtectedTransport</ns1:AuthnContextClassRef></ns0:RequestedAuthnContext>' |
| 232 | + ) |
220 | 233 |
|
221 | 234 |
|
222 | 235 | def test_2(): |
|
0 commit comments