Skip to content

Commit

Permalink
fix(aud): Update set_current_user proxy fn to pass in expected aud
Browse files Browse the repository at this point in the history
* based on flask.current_app.config
* Since this already assumes Flask request ctx, I think OK to look in Flask app cfg in this case
  • Loading branch information
vpsx committed Oct 12, 2020
1 parent 6639abd commit c34338b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/authutils/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@


def set_current_user(**kwargs):
flask.g.user = CurrentUser(**kwargs)
expected_audience = flask.current_app.config.get("USER_API")
# Gen3 services use both USER_API and BASE_URL
if not expected_audience:
expected_audience = flask.current_app.config.get("BASE_URL")

flask.g.user = CurrentUser(jwt_kwargs={"audience": expected_audience}, **kwargs)
set_current_token(flask.g.user._claims)
return flask.g.user

Expand Down

0 comments on commit c34338b

Please sign in to comment.