@@ -159,14 +159,6 @@ def authentication():
159159 # overwrite the headers via wsgi environ. request.headers itself is read-only
160160 tapis_token = auth_token .replace ('Bearer ' , '' )
161161 logger .debug (f"found auth header; setting environ X-Tapis-Token to { tapis_token } " )
162-
163- # tokens might have aud, if jwt.decode in tapisservice doesn't specify expected aud you'll
164- # get invalid aud. Either we can somehow pop aud or specify to jwt.decode(options={'verify_aud': False})
165- # Instead of verify = false we can also specify a list of valid auds. Pop aud would require
166- # re-encoding+sigining key. We don't have private tenant key in auth though. Ignoring for now, only
167- # bookstack looks for this when running their auth.
168- # resolve_tenant_id_for_request decode needs aud to expect - https://github.com/jpadilla/pyjwt/blob/master/docs/usage.rst#audience-claim-aud
169-
170162 # modify the WSGI environment directly
171163 # wsgi requires headers be uppercase, no dashes, and prefixed with HTTP_
172164 request .environ ['HTTP_X_TAPIS_TOKEN' ] = tapis_token
@@ -176,11 +168,19 @@ def authentication():
176168 # debug logs
177169 try :
178170 headers = request .headers
179- logger .debug (f"before auth.authentication(). request.headers: { headers } " )
171+ logger .debug (f"before auth.authentication(). request.headers: { headers . keys () } " )
180172 except Exception as e :
181173 pass
182-
183- auth .authentication ()
174+
175+ # tokens might have aud, if jwt.decode in tapisservice doesn't specify expected aud you'll
176+ # get invalid aud. Either we can somehow pop aud or specify to jwt.decode(options={'verify_aud': False})
177+ # Instead of verify = false we can also specify a list of valid auds. Pop aud would require
178+ # re-encoding+signing key. We don't have private tenant key in auth though. Ignoring for now, only
179+ # bookstack looks for this when running their auth.
180+ # resolve_tenant_id_for_request decode needs aud to expect - https://github.com/jpadilla/pyjwt/blob/master/docs/usage.rst#audience-claim-aud
181+ # Edit, expected_aud now exists. Bookstack asks for aud == client_id. For now we'll just allow any aud, especially as this is one endpoint.
182+
183+ auth .authentication (expected_aud = ["*" ])
184184 # always resolve the request tenant id based on the URL:
185185 auth .resolve_tenant_id_for_request ()
186186 # make sure this request is for a tenant served by this authenticator
0 commit comments