Skip to content

Commit 6482e6a

Browse files
[GH-49] Fix Azure tenants by enabling requests for both Password and X509 (#54)
* Configure CascadiaAzureIdp and FredHutchAzureIdp to request both Password and X509 * [Bot] Update version to 1.2.8 --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent e8db5dd commit 6482e6a

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "uw-saml"
3-
version = "1.2.7"
3+
version = "1.2.8"
44
description = "A UW-specific adapter to the python3-saml package."
55
authors = []
66
license = "Apache 2.0"

uw_saml2/idp/federated.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class CascadiaAzureIdp(IdpConfig):
6666
wJPxARowqyxR5q6PWX5JzOtFzuCx0vJ/jI0o8iAg53fOitgDFj3E6/qxjPhoDY+Q
6767
Pq4dr8god4m9Nr6k8kFWBbL2sXn1GC72SDeuvk0Q4X3t8tLb
6868
"""
69+
multi_authn_context_x509 = True
6970

7071

7172
class CollegenetIdp(IdpConfig):
@@ -140,6 +141,7 @@ class FredHutchAzureIdp(IdpConfig):
140141
fMU1NZFfOfsaDjM18iSBDcsYIDeSadDh8knyFRxYGXHYrifEEq5qZBgnXXhYZLse
141142
4BimG9X9nynGlI6QcU5Qj7gnddQOQpk2OFFAGoUBw+vQaZNZLDGGcyvbRaueuXSh
142143
4gzm/WDtjnJ/Cod/Qg8OfJLEARBkLQZpvCFlTDFJ1dkDDRMC"""
144+
multi_authn_context_x509 = True
143145

144146

145147
class SccaIdp(IdpConfig):

uw_saml2/idp/uw.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ class UwIdp(IdpConfig):
3939
}
4040

4141

42+
class MultiAuthnContextX509(UwIdp):
43+
mfazure_factor = True
44+
45+
4246
class UwIdpTwoFactor(UwIdp):
4347
two_factor = True
4448

uw_saml2/sp.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
from urllib.parse import urlparse
33
import os
44

5+
MULTI_AUTHN_CONTEXT_X509 = [
6+
"urn:oasis:names:tc:SAML:2.0:ac:classes:Password",
7+
"urn:oasis:names:tc:SAML:2.0:ac:classes:X509",
8+
]
9+
510
TWO_FACTOR_CONTEXT = "https://refeds.org/profile/mfa"
611

712

@@ -46,7 +51,7 @@ def cert(self):
4651
def key(self):
4752
return self._read_file(self.key_file)
4853

49-
def config(self, idp, two_factor=False):
54+
def config(self, idp, two_factor=False, mfazure_factor=False):
5055
"""Return config in a way that makes sense to OneLogin_Saml2_Auth."""
5156
data = {
5257
"strict": True,
@@ -74,4 +79,15 @@ def config(self, idp, two_factor=False):
7479
}
7580
}
7681
)
82+
83+
if mfazure_factor or getattr(idp, "multi_authn_context_x509", False):
84+
data.update(
85+
{
86+
"security": {
87+
"requestedAuthnContext": MULTI_AUTHN_CONTEXT_X509,
88+
"failOnAuthnContextMismatch": True,
89+
}
90+
}
91+
)
92+
7793
return data

0 commit comments

Comments
 (0)