Skip to content

Commit 0228a52

Browse files
pandafyc00kiemon5ter
authored andcommitted
Adds configuration directive for RequestedAuthnContext #806
Closes #806
1 parent 5583f16 commit 0228a52

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/saml2/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"sp_type",
105105
"sp_type_in_metadata",
106106
"requested_attributes",
107+
"requested_authn_context",
107108
]
108109

109110
AA_IDP_ARGS = [

tests/test_31_config.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
from saml2 import BINDING_HTTP_REDIRECT, BINDING_SOAP, BINDING_HTTP_POST
99
from saml2.config import SPConfig, IdPConfig, Config
10-
10+
from saml2.saml import AUTHN_PASSWORD_PROTECTED, AuthnContextClassRef
11+
from saml2.samlp import RequestedAuthnContext
1112
from saml2 import logger
1213

1314
from pathutils import dotname, full_path
@@ -26,8 +27,14 @@
2627
"urn:mace:example.com:saml:roland:idp": {
2728
'single_sign_on_service':
2829
{'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+
),
3138
}
3239
},
3340
"key_file": full_path("test.key"),
@@ -217,6 +224,7 @@ def test_1():
217224
'http://localhost:8088/sso/'}}]
218225

219226
assert c.only_use_keys_in_metadata
227+
assert 'PasswordProtectedTransport' in c._sp_requested_authn_context.to_string().decode()
220228

221229

222230
def test_2():

0 commit comments

Comments
 (0)