2
2
SATOSA microservice that uses a configured ordered list of
3
3
attributes that may be asserted by a SAML IdP to construct
4
4
a primary identifier or key for the user and assert it as
5
- the value for a configured attribute, for example uid.
5
+ the value for a configured attribute, for example uid.
6
6
"""
7
7
8
8
import satosa .micro_services .base
@@ -34,7 +34,7 @@ def constructPrimaryIdentifier(self, data, ordered_identifier_candidates):
34
34
Construct and return a primary identifier value from the
35
35
data asserted by the IdP using the ordered list of candidates
36
36
from the configuration.
37
- """
37
+ """
38
38
logprefix = PrimaryIdentifier .logprefix
39
39
context = self .context
40
40
@@ -63,9 +63,9 @@ def constructPrimaryIdentifier(self, data, ordered_identifier_candidates):
63
63
if candidate ['name_id_format' ] in name_id :
64
64
nameid_value = name_id [candidate ['name_id_format' ]]
65
65
66
- # Only add the NameID value asserted by the IdP if it is not already
66
+ # Only add the NameID value asserted by the IdP if it is not already
67
67
# in the list of values. This is necessary because some non-compliant IdPs
68
- # have been known, for example, to assert the value of eduPersonPrincipalName
68
+ # have been known, for example, to assert the value of eduPersonPrincipalName
69
69
# in the value for SAML2 persistent NameID as well as asserting
70
70
# eduPersonPrincipalName.
71
71
if nameid_value not in values :
@@ -85,7 +85,7 @@ def constructPrimaryIdentifier(self, data, ordered_identifier_candidates):
85
85
# to do so.
86
86
if 'add_scope' in candidate :
87
87
if candidate ['add_scope' ] == 'issuer_entityid' :
88
- scope = data .to_dict ()[ ' auth_info' ][ ' issuer' ]
88
+ scope = data .auth_info . issuer
89
89
else :
90
90
scope = candidate ['add_scope' ]
91
91
satosa_logging (logger , logging .DEBUG , "{} Added scope {} to values" .format (logprefix , scope ), context .state )
@@ -118,7 +118,7 @@ def process(self, context, data):
118
118
119
119
# Find the entityID for the IdP that issued the assertion
120
120
try :
121
- idpEntityID = data .to_dict ()[ ' auth_info' ][ ' issuer' ]
121
+ idpEntityID = data .auth_info . issuer
122
122
except KeyError as err :
123
123
satosa_logging (logger , logging .ERROR , "{} Unable to determine the entityID for the IdP issuer" .format (logprefix ), context .state )
124
124
return super ().process (context , data )
@@ -133,7 +133,7 @@ def process(self, context, data):
133
133
if spEntityID in self .config :
134
134
config = self .config [spEntityID ]
135
135
satosa_logging (logger , logging .DEBUG , "{} For SP {} using configuration {}" .format (logprefix , spEntityID , config ), context .state )
136
-
136
+
137
137
# Obtain configuration details from the per-SP configuration or the default configuration
138
138
try :
139
139
if 'ordered_identifier_candidates' in config :
@@ -179,11 +179,11 @@ def process(self, context, data):
179
179
if not primary_identifier_val :
180
180
satosa_logging (logger , logging .WARN , "{} No primary identifier found" .format (logprefix ), context .state )
181
181
if on_error :
182
- # Redirect to the configured error handling service with
182
+ # Redirect to the configured error handling service with
183
183
# the entityIDs for the target SP and IdP used by the user
184
184
# as query string parameters (URL encoded).
185
185
encodedSpEntityID = urllib .parse .quote_plus (spEntityID )
186
- encodedIdpEntityID = urllib .parse .quote_plus (data .to_dict ()[ ' auth_info' ][ ' issuer' ] )
186
+ encodedIdpEntityID = urllib .parse .quote_plus (data .auth_info . issuer )
187
187
url = "{}?sp={}&idp={}" .format (on_error , encodedSpEntityID , encodedIdpEntityID )
188
188
satosa_logging (logger , logging .INFO , "{} Redirecting to {}" .format (logprefix , url ), context .state )
189
189
return Redirect (url )
0 commit comments