Fix trailing slash
Getting the following when verifying JWT in IDhub (possibly first service doing this?)
INFO:apigatewayauth.authentication:Incoming API token failed verification: Token has wrong audience https://webapp-{foobar}-nw.a.run.app, expected one of ['https://webapp-{foobar}-nw.a.run.app/']
Could override expected audience via env var but better the default behaves the same way as the API Gateway creates the JWT.
Part of https://gitlab.developers.cam.ac.uk/uis/devops/iam/idhub/api/-/issues/90
Merge request reports
Activity
assigned to @rjg21
FWIW, I expected that
API_GATEWAY_JWT_EXPECTED_AUDIENCE
would be set when this is deployed as the "canonical" URL for the application is only knowable by the deploying code. E.g. if the app is supposed to be accessed viahttps://my-cool-backend.service.apps.cam.ac.uk/
, then we don't want to accepthttps://webapp-{...}-nw.a.run.app
.More generally, I think my intention was that
API_GATEWAY_JWT_EXPECTED_AUDIENCE
would be set explicitly so that we didn't let the same entity presenting the auth token (being the incoming request in this case) also specify the expected audience (by means of theHost
header).So, my vote would be to fix this by documenting that
API_GATEWAY_JWT_EXPECTED_AUDIENCE
should be set by deployments.Ok, I'll change it so that:
- it is happy with a trailing slash or not even if the audience came from the env var.
- there is a line about the audience should really be specified
- the idhub/infra specifies the host
Edited by Robin Goodall
- Resolved by Robin Goodall
- Resolved by Robin Goodall
- Resolved by Robin Goodall
- Resolved by Robin Goodall
mentioned in commit 7ca86706