Commit graph

355 commits

Author SHA1 Message Date
653b807f5d replace github url 2025-06-20 09:45:28 +02:00
29d69ca2e0 add function to marshal aud into a string if the array has a len of 1, to comply with rfc 2025-06-20 09:39:40 +02:00
154fbe6420 Revert "feat(op): always verify code challenge when available (#721)"
Some checks failed
Code scanning - action / CodeQL-Build (push) Failing after 2m48s
Release / Go 1.23 test (push) Has been cancelled
Release / Go 1.24 test (push) Has been cancelled
Release / release (push) Has been cancelled
Breaks OIDC for some not yet updated applications, that we use.

This reverts commit c51628ea27.
2025-06-20 08:44:27 +02:00
Livio Spring
f94bd541d7
feat: update end session request to pass all params according to specification (#754)
* feat: update end session request to pass all params according to specification

* register encoder
2025-06-05 13:19:51 +02:00
Ayato
4f0ed79c0a
fix(op): Add mitigation for PKCE Downgrade Attack (#741)
* fix(op): Add mitigation for PKCE downgrade attack

* chore(op): add test for PKCE verification
2025-04-29 14:33:31 +00:00
Masahito Osako
5913c5a074
feat: enhance authentication response handling (#728)
- Introduced CodeResponseType struct to encapsulate response data.
- Added handleFormPostResponse and handleRedirectResponse functions to manage different response modes.
- Created BuildAuthResponseCodeResponsePayload and BuildAuthResponseCallbackURL functions for better modularity in response generation.
2025-04-29 14:17:28 +00:00
Ayato
c51628ea27
feat(op): always verify code challenge when available (#721)
Finally the RFC Best Current Practice for OAuth 2.0 Security has been approved.

According to the RFC:

> Authorization servers MUST support PKCE [RFC7636].
> 
> If a client sends a valid PKCE code_challenge parameter in the authorization request, the authorization server MUST enforce the correct usage of code_verifier at the token endpoint.

Isn’t it time we strengthen PKCE support a bit more?

This PR updates the logic so that PKCE is always verified, even when the Auth Method is not "none".
2025-03-24 18:00:04 +02:00
Iraq
2c64de821d
chore: updating go to 1.24 (#726)
* chore: updating go to 1.24

* fixup! chore: updating go to 1.24

* fixup! fixup! chore: updating go to 1.24

* fix device test (drop read error)

* drop older go versions

* drop unrelated formatter changes

---------

Co-authored-by: Iraq Jaber <IraqJaber@gmail.com>
Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
2025-03-14 16:12:26 +01:00
Tim Möhlmann
efd6fdad7a
fix: ignore empty json strings for locale (#678)
* Revert "fix: ignore all unmarshal errors from locale (#673)"

This reverts commit fbf009fe75.

* fix: ignore empty json strings for locale
2025-03-14 10:30:08 +00:00
BitMasher
7a767d8568
feat: add CanGetPrivateClaimsFromRequest interface (#717) 2025-03-12 14:00:29 +02:00
minami yoshihiko
4ef9529012
feat: support for session_state (#712)
* add default signature algorithm

* implements session_state in auth_request.go

* add test

* Update pkg/op/auth_request.go

link to the standard

Co-authored-by: Tim Möhlmann <muhlemmer@gmail.com>

* add check_session_iframe

---------

Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
Co-authored-by: Tim Möhlmann <muhlemmer@gmail.com>
2025-02-24 10:50:38 +00:00
Steve Ruckdashel
eb98343a65
fix: migrate deprecated io/ioutil.ReadFile to os.ReadFile (#714) 2025-02-21 09:52:02 +00:00
Ramon
de2fd41f40
fix: allow native clients to use https:// on localhost redirects (#691) 2025-01-17 13:53:19 +00:00
isegura-eos-eng
6d20928028
refactor: mark pkg/strings as deprecated in favor of stdlib (#680)
* refactor: mark pkg/strings as deprecated in favor of stdlib

* format: reword deprecate notice and use doc links
2024-11-15 18:47:32 +02:00
isegura-eos-eng
897c720070
fix(op): add scope to access token scope (#664) 2024-11-13 08:49:55 +00:00
Kevin Schoonover
8afb8b8d5f
feat(pkg/op): allow custom SupportedScopes (#675)
Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
2024-11-12 15:06:24 +00:00
David Sharnoff
fbf009fe75
fix: ignore all unmarshal errors from locale (#673) 2024-11-01 10:53:28 +02:00
Livio Spring
f1e4cb2245
feat(OP): add back channel logout support (#671)
* feat: add configuration support for back channel logout

* logout token

* indicate back channel logout support in discovery endpoint
2024-10-30 08:44:31 +00:00
Ayato
3b64e792ed
feat(oidc): return defined error when discovery failed (#653)
* feat(oidc): return defined error when discovery failed

* Use errors.Join() to join errors

Co-authored-by: Tim Möhlmann <muhlemmer@gmail.com>

* Remove unnecessary field

Co-authored-by: Tim Möhlmann <muhlemmer@gmail.com>

* Fix order and message

Co-authored-by: Tim Möhlmann <muhlemmer@gmail.com>

* Fix error order

* Simplify error assertion

Co-authored-by: Tim Möhlmann <muhlemmer@gmail.com>

---------

Co-authored-by: Tim Möhlmann <muhlemmer@gmail.com>
2024-09-20 12:33:28 +03:00
Tim Möhlmann
b555396744
fix(oidc): set client ID to access token JWT (#650)
* fix(oidc): set client ID to access token JWT

* fix test
2024-09-10 11:50:54 +02:00
David Sharnoff
67688db4c1
fix: client assertions for Okta (#636)
* fix client assertions for Okta

* review feedback
2024-08-26 11:11:01 +03:00
Tim Möhlmann
1e75773eaa
fix(op): initialize http Headers in response objects (#637)
* fix(op): initialize http Headers in response objects

* fix test

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
2024-08-21 09:34:26 +02:00
Tim Möhlmann
99301930ed
feat(crypto): hash algorithm for EdDSA (#638)
* feat(crypto): hash algorithm for EdDSA

* update code comment

* rp: modify keytype check to support EdDSA

* example: signing algs from discovery

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
2024-08-21 07:32:13 +00:00
Tim Möhlmann
0aa61b0b98
fix(op): do not redirect to unverified uri on error (#640)
Closes #627
2024-08-21 09:29:14 +02:00
Tim Möhlmann
b6f3b1e65b
feat(op): allow returning of parent errors to client (#629)
* feat(op): allow returning of parent errors to client

* update godoc

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
2024-08-09 05:10:11 +00:00
Elio Bischof
6f0a630ad4
fix: overwrite redirect content length (#632)
* fix: overwrite redirect content length

* copy redirect struct headers
2024-08-06 12:58:52 +03:00
Livio Spring
e5a428d4be
feat: support PKCS#8 (#623) 2024-07-09 15:55:50 +02:00
Tim Möhlmann
a7b5355580
feat(op): allow scope without openid (#613)
This changes removes the requirement of the openid scope to be set for all token requests.
As this library also support OAuth2-only authentication mechanisms we still want to sanitize requested scopes, but not enforce the openid scope.

Related to https://github.com/zitadel/zitadel/discussions/8068
2024-06-13 08:16:46 +02:00
minami yoshihiko
8a47532a8e
feat: add default signature algorithms (#606) 2024-05-17 10:17:54 +00:00
Yuval Marcus
5a84d8c4bc
fix: Omit non-standard, empty fields in RefreshTokenRequest when performing a token refresh (#599)
* Add omitempty tags

* Add omitempty to more fields
2024-05-06 08:13:52 +02:00
Yuval Marcus
24d43f538e
fix: Handle case where verifier Nonce func is nil (#594)
* Skip nonce check if verifier nonce func is nil

* add unit test
2024-05-02 09:46:12 +02:00
Tim Möhlmann
37ca0e472a
feat(op): authorize callback handler as argument in legacy server registration (#598)
This change requires an additional argument to the op.RegisterLegacyServer constructor which passes the Authorize Callback Handler.
This allows implementations to use their own handler instead of the one provided by the package.
The current handler is exported for legacy behavior.

This change is not considered breaking, as RegisterLegacyServer is flagged experimental.

Related to https://github.com/zitadel/zitadel/issues/6882
2024-04-30 20:27:12 +03:00
Kotaro Otaka
3512c72f1c
fix: to propagate context (#593)
Co-authored-by: Livio Spring <livio.a@gmail.com>
2024-04-22 11:40:21 +00:00
Kotaro Otaka
68d4e08f6d
feat: Added the ability to verify ID tokens using the value of id_token_signing_alg_values_supported retrieved from DiscoveryEndpoint (#579)
* feat(rp): to use signing algorithms from discovery configuration (#574)

* feat: WithSigningAlgsFromDiscovery to verify IDTokenVerifier() behavior in RP with
2024-04-16 08:41:31 +00:00
Ethan Heilman
959376bde7
Fixes typos in GoDoc and comments (#591) 2024-04-16 08:18:32 +00:00
Tim Möhlmann
33f8df7eb2
feat(deps): update go-jose to v4 (#588)
This change updates to go-jose v4, which was a new major release.

jose.ParseSigned now expects the supported signing algorithms to be passed, on which we previously did our own check. As they use a dedicated type for this, the slice of string needs to be converted. The returned error also need to be handled in a non-standard way in order to stay compatible.

For OIDC v4 we should use the jose.SignatureAlgorithm  type directly and wrap errors, instead of returned static defined errors.

Closes #583
2024-04-11 18:13:30 +03:00
Jan-Otto Kröpke
06f37f84c1
fix: Fail safe, if optional endpoints are not given (#582) 2024-04-09 13:02:31 +00:00
Célian GARCIA
e75a061807
feat: support verification_url workaround for DeviceAuthorizationResponse unmarshal (#577) 2024-04-08 13:43:31 +00:00
Célian GARCIA
c89d0ed970
feat: return oidc.Error in case of call token failure (#571) 2024-04-01 13:55:22 +00:00
Tim Möhlmann
56397f88d5
feat(oidc): add actor claim to introspection response (#570)
With impersonation we assign an actor claim to our JWT/ID Tokens. This change adds the actor claim to the introspection response to follow suit.

This PR also adds the `auth_time` and `amr` claims for consistency.
2024-03-18 11:36:16 +01:00
Tim Möhlmann
4d63d68c9e
feat(op): allow setting the actor to Token Requests (#569)
For impersonation token exchange we need to persist the actor throughout token requests, including refresh token.
This PR adds the optional TokenActorRequest interface which allows to pass such actor.
2024-03-14 06:57:44 +00:00
adlerhurst
565a022e91 Merge branch 'extend-tracing' of https://github.com/zitadel/oidc into extend-tracing 2024-03-14 07:51:35 +01:00
adlerhurst
03f3bc693b fix test 2024-03-14 07:50:29 +01:00
Silvan
0ffd13c780
Merge branch 'main' into extend-tracing 2024-03-13 15:45:19 +01:00
adlerhurst
1b94f796eb move tracer to client,
add tracing in rs, client
2024-03-13 15:45:03 +01:00
Tim Möhlmann
ad79802968
feat: extend token exchange response (#567)
* feat: extend token exchange response

This change adds fields to the token exchange and token claims types.

The `act` claim has been added to describe the actor in case of impersonation or delegation. An actor can be nested in case an obtained token is used as actor token to obtain impersonation or delegation. This allows creating a chain of actors. See [RFC 8693, section 4.1](https://www.rfc-editor.org/rfc/rfc8693#name-act-actor-claim).

The `id_token` field has been added to the Token Exchange response  so an ID Token can be returned along with an access token. This is not specified in RFC 8693, but it allows us be consistent with OpenID responses when the scope `openid` is set, while the requested token type may remain access token.

* allow jwt profile for token exchange client

* add invalid target error
2024-03-13 16:26:09 +02:00
adlerhurst
0fe7c3307f fix parse 2024-03-07 15:25:23 +01:00
adlerhurst
7069813ec7 correct span names 2024-03-07 10:44:24 +01:00
adlerhurst
88209ac11d fix tests 2024-03-06 19:08:48 +01:00
adlerhurst
bdcccc3303 feat(client): tracing in rp 2024-03-06 18:39:27 +01:00