@@ -64,7 +64,6 @@ def do_response(
6464 client_id : Optional [str ] = "" ,
6565 ** kwargs ,
6666 ) -> dict :
67-
6867 if "error" in kwargs and kwargs ["error" ]:
6968 return Endpoint .do_response (self , response_args , request , ** kwargs )
7069
@@ -135,35 +134,16 @@ def process_request(self, request=None, **kwargs):
135134 if token .is_active () is False :
136135 return self .error_cls (error = "invalid_token" , error_description = "Invalid Token" )
137136
138- allowed = True
139- _auth_event = _grant .authentication_event
140- # if the authentication is still active or offline_access is granted.
141- if not _auth_event ["valid_until" ] >= utc_time_sans_frac ():
142- logger .debug (
143- "authentication not valid: {} > {}" .format (
144- datetime .fromtimestamp (_auth_event ["valid_until" ]),
145- datetime .fromtimestamp (utc_time_sans_frac ()),
146- )
147- )
148- allowed = False
149-
150- # This has to be made more finegrained.
151- # if "offline_access" in session["authn_req"]["scope"]:
152- # pass
153-
154137 _cntxt = self .upstream_get ("context" )
155- if allowed :
156- _claims_restriction = _cntxt .claims_interface .get_claims (
157- _session_info ["branch_id" ], scopes = token .scope , claims_release_point = "userinfo"
158- )
159- info = _cntxt .claims_interface .get_user_claims (
160- _session_info ["user_id" ],
161- claims_restriction = _claims_restriction ,
162- client_id = _session_info ["client_id" ]
163- )
164- info ["sub" ] = _grant .sub
165- if _grant .add_acr_value ("userinfo" ):
166- info ["acr" ] = _grant .authentication_event ["authn_info" ]
138+ _claims_restriction = _cntxt .claims_interface .get_claims (
139+ _session_info ["branch_id" ], scopes = token .scope , claims_release_point = "userinfo"
140+ )
141+ info = _cntxt .claims_interface .get_user_claims (
142+ _session_info ["user_id" ], claims_restriction = _claims_restriction
143+ )
144+ info ["sub" ] = _grant .sub
145+ if _grant .add_acr_value ("userinfo" ):
146+ info ["acr" ] = _grant .authentication_event ["authn_info" ]
167147
168148 extra_claims = kwargs .get ("extra_claims" )
169149 if extra_claims :
@@ -213,7 +193,7 @@ def parse_request(self, request, http_info=None, **kwargs):
213193 def _enforce_policy (self , request , response_info , token , config ):
214194 policy = config ["policy" ]
215195 callable = policy ["function" ]
216- kwargs = policy .get ("kwargs" , {})
196+ kwargs = policy .get ("kwargs" ) or {}
217197
218198 if isinstance (callable , str ):
219199 try :
0 commit comments