HomePhabricator
Diffusion Comm d0a208d19dd8

[services-lib] Support auth token in HTTP middleware

Description

[services-lib] Support auth token in HTTP middleware

Summary:
Modified auth middleware to support both new auth token enum and existing UserIdentity (as a case of that enum). The whole credential enum is now parsed and stored in the extension.

The UserIdentity case is now handled by accessing the token enum first.

Depends on D9242

Test Plan:
Created test endpoint in reports service:

  • Argument of type UserIdentity still works as before
  • Argument of type AuthorizationCredential works the same way too - we're able to read UserIdentity from it
  • If we pass services token where we expect UserIdentity, a HTTP 403 is returned
  • Middleware gate (validation function) works for both

Reviewers: michal, varun, jon

Reviewed By: michal

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D9243

Details

Provenance
bartekAuthored on Sep 19 2023, 4:02 AM
Reviewer
michal
Differential Revision
D9243: [services-lib] Support auth token in HTTP middleware
Parents
rCOMM863cdaaa62b7: [services-lib] Use constant-time-eq for token verification
Branches
Unknown
Tags
Unknown