luka-j / matf-rs2-api-gateway

0 stars 1 forks source link

[CCO] Implement auth operation #23

Closed luka-j closed 1 year ago

luka-j commented 1 year ago

Specify and implement auth operation. A request should contain type, authServerUrl and credential at least. Response should return some info about the user.

Examples:

  1. for type: oauth2 and/or oidc, auth server url: auth.example.com and credential: eyJxxx, microservice will make a GET request to auth.example.com/oidc/v1/userinfo with header Authorization: Bearer eyJxxx. If server returns 200 response, map sub to id, preferred_username to username and put the rest of the parameters to userData map. If server returns 401 response, signalize that credential is invalid (e.g. via gRPC error). Concrete example using Zitadel cloud as auth service: image
  2. for type: basic, auth server url: auth.example.com/validate and credential: cnM6Mg==, microservice will make a POST request to auth.example.com/validate with header Authorization: Basic cnM6Mg==, and handle response parsing the same as in previous. I don't have a concrete example here.
  3. possibly other types, e.g. OAS3 allows type to be apiKey (see here), but I'm not sure how exactly would that work and what is needed. Maybe consider using HashiCorp Vault (installation docs, C# lib), either for this, basic auth, both, or something else.