FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects

verify incoming id token for API backends

Merged Dr Rich Wareham requested to merge issue-4-validate-gateway-token into main
All threads resolved!

Warning This MR depends on !4 (merged) having been merged first so that the DRF IsAuthenticated permission functions as expected.

Add verification for the Authorization header for incoming requests. The defaults are to verify that the request is appropriately authenticated with a Google service account corresponding to the API Gateway. Expected issuer, authorised parties, issuer certificate URLs, etc can be customised via settings. This is unlikely to be used in production but is useful when combined with the API Gateway emulator for local development.

Verification is only enabled if opt-ed in to via a dedicated setting so this is change does not break backwards compatibility.

Tests have been updated to exercise verification assuming that the Google verification library works as documented.

NO CHANGES SHOULD BE NEEDED FOR APPLICATIONS CURRENTLY DEPLOYED

However, local developement will need some configuration changes. An example of changes needed to docker-compose.yml and .../settings/base.py for projects making use of the API Gateway emulator can be found in https://gitlab.developers.cam.ac.uk/uis/devops/iam/identity/identity-system/-/commit/8a5fac7655b4fcfc1e76d6fdd3524523f516bdf6#35b8c13cf2eb2a194eada000eb310d65aed53b2a.

Closes #4 (closed)

Edited by Dr Rich Wareham

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Mike Knee
  • Mike Knee
  • Mike Knee
  • Mike Knee
  • Dr Rich Wareham added 3 commits

    added 3 commits

    • 5259d6f9 - fix: change ..._VERIFY_TOKEN setting to _ENFORCE_ID_TOKEN_VERIFICATION
    • e431de6e - fix: make trusted issuers and expected parties settings lists
    • 7febe88e - fix(id_token): change spelling of _API_GATEWAY_SERVICE_ACCOUNTS

    Compare with previous version

  • Dr Rich Wareham requested review from @mk2155

    requested review from @mk2155

  • Mike Knee approved this merge request

    approved this merge request

  • Mike Knee resolved all threads

    resolved all threads

  • Dr Rich Wareham mentioned in commit 4fa01af1

    mentioned in commit 4fa01af1

  • Please register or sign in to reply
    Loading