Skip to content

Commit

Permalink
Merge PR #177 into unstable/v1
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Aug 10, 2023
2 parents ade57f5 + ba3ecc9 commit b7f401d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion oidc-exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ def assert_successful_audience_call(resp: requests.Response, domain: str):

def render_claims(token: str) -> str:
_, payload, _ = token.split(".", 2)

# urlsafe_b64decode needs padding; JWT payloads don't contain any.
payload += "=" * (4 - (len(payload) % 4))
claims = json.loads(base64.urlsafe_b64decode(payload))

def _get(name: str) -> str: # noqa: WPS430
Expand Down Expand Up @@ -207,7 +210,8 @@ def _get(name: str) -> str: # noqa: WPS430

die(
_SERVER_REFUSED_TOKEN_EXCHANGE_MESSAGE.format(
reasons=reasons, rendered_claims=rendered_claims,
reasons=reasons,
rendered_claims=rendered_claims,
),
)

Expand Down

0 comments on commit b7f401d

Please sign in to comment.