zitadel/internal/api/oidc
Tim Möhlmann f5e9d4f57f
fix(oidc): IDP and machine user auth methods (#7992)
# Which Problems Are Solved

After https://github.com/zitadel/zitadel/pull/7822 was merged we
discovered that
v2 tokens that where obtained through an IDP using the v1 login, can't
be used for
zitadel API calls.

- Because we used to store the AMR claim on the auth request, but
internally use the domain.UserAuthMethod type. AMR has no notion of an
IDP login, so that "factor" was lost
during conversion. Rendering those v2 tokens invalid on the zitadel API.
- A wrong check on machine user tokens falsly allowed some tokens to be
valid
- The client ID was set to tokens from client credentials and JWT
profile, which made client queries fail in the validation middleware.
The middleware expects client ID unset for machine users.

# How the Problems Are Solved

Store the domain.AuthMethods directly in  the auth requests and session,
instead of using AMR claims with lossy conversion.

- IDPs have seperate auth method, which is not an AMR claim
- Machine users are treated specialy, eg auth methods are not required.
- Do not set the client ID for client credentials and JWT profile

# Additional Changes

Cleaned up mostly unused `oidc.getInfoFromRequest()`.

# Additional Context

- Bugs were introduced in https://github.com/zitadel/zitadel/pull/7822
and not yet part of a release.
- Reported internally.
2024-05-23 05:35:10 +00:00
..
access_token.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
amr_test.go feat(oidc): token exchange impersonation (#7516) 2024-03-20 10:18:46 +00:00
amr.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
auth_request_converter_v2.go merge main into next 2023-10-19 12:34:00 +02:00
auth_request_converter.go fix(oidc): IDP and machine user auth methods (#7992) 2024-05-23 05:35:10 +00:00
auth_request_integration_test.go feat(oidc): optimize the userinfo endpoint (#7706) 2024-04-09 15:15:35 +02:00
auth_request.go fix(oidc): IDP and machine user auth methods (#7992) 2024-05-23 05:35:10 +00:00
client_converter.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
client_credentials.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
client_integration_test.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
client.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
device_auth.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
error_test.go fix: uniform oidc errors (#7237) 2024-01-18 07:10:49 +01:00
error.go fix(oidc): return bad request for base64 errors (#7730) 2024-04-09 08:42:59 +02:00
introspect.go fix(oidc): roles in userinfo for client credentials token (#7763) 2024-04-16 13:02:38 +00:00
jwt-profile.go fix: uniform oidc errors (#7237) 2024-01-18 07:10:49 +01:00
key_test.go chore(deps): update all go deps (#7773) 2024-04-15 09:17:36 +00:00
key.go chore(deps): update all go deps (#7773) 2024-04-15 09:17:36 +00:00
oidc_integration_test.go feat(oidc): optimize the userinfo endpoint (#7706) 2024-04-09 15:15:35 +02:00
op.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
server_integration_test.go chore(oidc): add refresh token error integration test (#7766) 2024-04-17 08:38:03 +00:00
server_test.go feat: restrict languages (#6931) 2023-12-05 11:12:01 +00:00
server.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
token_client_credentials_integration_test.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
token_client_credentials.go fix(oidc): IDP and machine user auth methods (#7992) 2024-05-23 05:35:10 +00:00
token_code.go fix(oidc): IDP and machine user auth methods (#7992) 2024-05-23 05:35:10 +00:00
token_device.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
token_exchange_converter.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
token_exchange_integration_test.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
token_exchange.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
token_jwt_profile_integration_test.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
token_jwt_profile.go fix(oidc): IDP and machine user auth methods (#7992) 2024-05-23 05:35:10 +00:00
token_refresh.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
token.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00
userinfo_integration_test.go fix(oidc): roles in userinfo for client credentials token (#7763) 2024-04-16 13:02:38 +00:00
userinfo_test.go fix(oidc): roles in userinfo for client credentials token (#7763) 2024-04-16 13:02:38 +00:00
userinfo.go perf(oidc): optimize token creation (#7822) 2024-05-16 07:07:56 +02:00