Skip to content

Commit 34d8597

Browse files
rohec00kiemon5ter
authored andcommitted
Changes after comments from Ivan.
1 parent b3860b8 commit 34d8597

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/satosa/backends/idpy_oidc.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ def __init__(self, auth_callback_func, internal_attributes, config, base_url, na
5050
self.client.do_provider_info()
5151
self.client.do_client_registration()
5252

53+
_redirect_uris = self.client.context.claims.get_usage('redirect_uris')
54+
if not _redirect_uris:
55+
raise SATOSAError("Missing path in redirect uri")
56+
self.redirect_path = urlparse(_redirect_uris[0]).path
57+
5358
def start_auth(self, context, internal_request):
5459
"""
5560
See super class method satosa.backends.base#start_auth
@@ -70,11 +75,7 @@ def register_endpoints(self):
7075
:return: A list that can be used to map the request to SATOSA to this endpoint.
7176
"""
7277
url_map = []
73-
redirect_path = self.client.context.claims.get_usage('redirect_uris')
74-
if not redirect_path:
75-
raise SATOSAError("Missing path in redirect uri")
76-
redirect_path = urlparse(redirect_path[0]).path
77-
url_map.append((f"^{redirect_path.lstrip('/')}$", self.response_endpoint))
78+
url_map.append((f"^{self.redirect_path.lstrip('/')}$", self.response_endpoint))
7879
return url_map
7980

8081
def response_endpoint(self, context, *args):
@@ -120,7 +121,10 @@ def _translate_response(self, response, issuer):
120121
:param subject_type: public or pairwise according to oidc standard.
121122
:return: A SATOSA internal response.
122123
"""
123-
auth_info = AuthenticationInformation(UNSPECIFIED, str(datetime.now()), issuer)
124+
timestamp = response["auth_time"]
125+
auth_class_ref = response.get("amr", response.get("acr", UNSPECIFIED))
126+
auth_info = AuthenticationInformation(auth_class_ref, timestamp, issuer)
127+
124128
internal_resp = InternalData(auth_info=auth_info)
125129
internal_resp.attributes = self.converter.to_internal("openid", response)
126130
internal_resp.subject_id = response["sub"]

0 commit comments

Comments
 (0)