Commit Graph

209 Commits

Author SHA1 Message Date
Jeff Hickman 5baca2843a
feat: add handler for /.well-known/oauth-authorization-server. (#3980)
In order to support OAuth2.1 and some specific integrations that
leverage the `/.well-known/oauth-authorization-server` endpoint, this PR
adds a handler for the specific endpoint. The
`/.well-known/openid-configuration` endpoint already supports all
configuration items that conform to this endpoint as seen here:
https://datatracker.ietf.org/doc/html/rfc8414
2025-04-28 10:31:53 +02:00
Jonas Hungershausen 6da0fd327e
feat: improve oauth2 event data (#3975) 2025-04-14 10:17:22 +02:00
Arne Luenser 241dd45fa1
feat: add error reason to OAuth2TokenExchangeError event (#3971) 2025-04-10 10:47:49 +00:00
Nikos Sklikas 5215d2482a
feat: implement RFC 8628 (#3912)
This patch introduces the OAuth 2.0 Device Authorization Grant to Ory
Hydra. The OAuth 2.0 device authorization grant is designed for
Internet-connected devices that either lack a browser to perform a
user-agent-based authorization or are input constrained to the extent
that requiring the user to input text in order to authenticate during
the authorization flow is impractical. It enables OAuth clients on such
devices (like smart TVs, media consoles, digital picture frames, and
printers) to obtain user authorization to access protected resources by
using a user agent on a separate device.

The OAuth 2.0 Device Authorization Grant may also become relevant for AI
Agent authentication flows and is generally an amazing step and
innovation for this project.

A very special thanks goes to @nsklikas from
[Canonical](https://canonical.com), @supercairos from
[shadow.tech](https://shadow.tech) and @BuzzBumbleBee.

For more details, please check out the documentation
(https://github.com/ory/docs/pull/2026)

To implement this feature, you will need to implement two additional
screens in your login and consent application. A reference
implementation can be found
[here](99ca6ad544/src/routes/device.ts).

Closes #3851
Closes #3252
Closes #3230
Closes #2416
2025-02-26 13:41:41 +01:00
Arne Luenser 5d8635c943
fix: revoke by consent request ID (#3947)
This is a follow-up to #3932.

This makes several improvements, chiefly restoring backwards
compatibility to Hydra before #3932. We now return both the `challenge`
as well as the `consent_request_id` from our APIs and distinguish
between them clearly.

Closes #3941
2025-02-20 19:41:41 +01:00
hackerman 0a6c966206
feat: handle concurrent refreshes and improve graceful refreshing (#3895)
This patch improves Ory Hydra's ability to deal with refresh flows which, for example, concurrently refresh the same token. Furthermore, graceful token refresh has been improved to handle a variety of edge cases and scenarios.

Additionally, serializability errors in CockroachDB are now correctly retried.

See https://github.com/ory-corp/cloud/issues/7311
Closes https://github.com/ory/hydra/pull/3895
2024-12-17 09:57:05 +01:00
Henning Perl 41476ec062
feat: support more claims in password grant (#3864)
For the resource owner password grant, the Kratos identity ID is now written to the sub claim, and the username is written to the ext.username claim. Further, token hooks are called for the initial token issuance as well as refresh flows for access tokens issued via the resource owner password grant, allowing users to customize the fields present in the access token (for the jwt strategy) as well as on introspection.

---------

Co-authored-by: Arne Luenser <arne.luenser@ory.sh>
2024-10-31 09:40:39 +01:00
Arne Luenser 9cc5f28825
fix: advertise support for response_mode=form_post in OIDC discovery document (#3861) 2024-10-23 08:37:32 +02:00
Arne Luenser fa50e3e999 fix: incorrect context passthru 2024-08-14 11:20:19 +02:00
Jonas Hungershausen d0e047ccc8
fix(docs): adjust note about SDK support on oauth2 flow endpoints (#3812) 2024-08-06 14:56:48 +02:00
hackerman 1bbfdb56e5
fix: do not retry sending responses (#3764) 2024-05-08 11:41:50 +02:00
hackerman 5b106aadb0
fix: wrap authorize response in transaction (#3763) 2024-05-07 17:04:59 +02:00
Henning Perl 67a85cc799
fix: wrap token handler in transaction (#3730) 2024-03-05 14:58:43 +01:00
hackerman d1f9ba8ede
fix: correct id token type in token exchange response (#3625)
Closes https://github.com/ory/client-go/issues/2
2023-09-05 15:15:21 +02:00
Henning Perl 0176adc178
fix: verifiable credentials JWT format (#3614) 2023-08-23 17:19:32 +02:00
Henning Perl 9f1c8d1920
fix: add kid to verifiable credential header (#3606) 2023-08-16 14:12:43 +02:00
dastein1 c72a31641e
feat: allow to disable claim mirroring (#3563)
This PR introduces another config option called `oauth2:mirror_top_level_claims` which may be used to disable the mirroring of custom claims into the `ext` claim of the jwt.
This new config option is an opt-in. If unused the behavior remains as-is to ensure backwards compatibility.

Example:

```yaml
oauth2:
  allowed_top_level_claims:
    - test_claim
  mirror_top_level_claims: false # -> this will prevent test_claim to be mirrored within ext
```

Closes https://github.com/ory/hydra/issues/3348
2023-08-11 12:04:07 +02:00
Henning Perl 219a7c068f
feat: add support for OIDC VC (#3575)
This adds initial support for issuing verifiable credentials
as specified in https://openid.net/specs/openid-connect-userinfo-vc-1_0.html.

Because the spec is still in draft, public identifiers are
suffixed with `draft_00`.
2023-08-04 10:57:36 +02:00
Henning Perl 44ed0ac895
feat: add event tracing (#3546) 2023-06-19 13:22:54 +02:00
Henning Perl f29fe3af97
feat: stateless authorization code flow (#3515)
This patch optimizes the performance of authorization code grant flows by minimizing the number of database queries. We acheive this by storing the flow in an AEAD-encoded cookie and AEAD-encoded request parameters for the authentication and consent screens. 

BREAKING CHANGE:

* The client that is used as part of the authorization grant flow is stored in the AEAD-encoding. Therefore, running flows will not observe updates to the client after they were started.
* Because the login and consent challenge values now include the AEAD-encoded flow, their size increased to around 1kB for a flow without any metadata (and increases linearly with the amount of metadata). Please adjust your ingress / gateway accordingly.
2023-06-12 20:27:00 +02:00
hackerman cf20054f53
chore: remove unneeded dependency (#3494) 2023-04-18 12:59:49 +02:00
Henning Perl a6beed4659
feat: allow setting access token type in client (#3446)
The access token type (`jwt` or `opaque`) can now be set in the client configuration. The value set here will overwrite the global value for all flows concerning that client.
2023-03-02 16:17:09 +01:00
hackerman 9a5afd2135
chore: update alpine (#3449) 2023-02-28 08:17:06 +01:00
Arne Luenser f56e5fad74 fix: append /v2 to module path 2023-01-28 08:40:41 +01:00
Arne Luenser 488f930e4f fix: clean up unused code 2023-01-28 08:40:41 +01:00
Loïc Mangeonjean 50666b96ef
fix: prevent multiple redirections to post logout url (#3366)
Closes #3342
2022-12-05 11:49:02 +01:00
Jonas Hungershausen 93bac074b3
fix: add `client_id` and `client_secret` to `revokeOAuth2Token` (#3373) 2022-12-01 09:15:40 +01:00
Kevin Goslar d768cf6580
docs: standardize license headers (#3216) 2022-11-03 10:10:12 -05:00
Savvas Mantzouranidis f59f1c6834
fix: scope type should be string instead of int (#3337)
Closes https://github.com/ory/sdk/pull/223
2022-11-03 15:48:38 +02:00
aeneasr 142b55f295 refactor(sdk): OAuth2 SDK API
BREAKING CHANGE: SDK naming has changed for the following operations:

```patch
ory.
-   V0alpha2Api.AdminDeleteOAuth2Token(context.Background()).
+   OAuth2Api.DeleteOAuth2Token(context.Background()).
    ClientId("foobar").Execute()

ory.
-   V0alpha2Api.RevokeOAuth2Token(
+   OAuth2Api.RevokeOAuth2Token(
        context.WithValue(context.Background(), sdk.ContextBasicAuth, sdk.BasicAuth{
            UserName: clientID,
            Password: clientSecret,
        })).Token(token).Execute()

ory.
-   V0alpha2Api.AdminIntrospectOAuth2Token(context.Background()).
+   OAuth2Api.IntrospectOAuth2Token(context.Background()).
    Token(token).
    Scope("foo bar")).Execute()
```
2022-10-11 17:01:24 +02:00
aeneasr 6b601564c1 refactor(sdk): rename errors
BREAKING CHANGE: Error models in the generated SDK have been renamed:

```patch
- oAuth2ApiError
+ errorOAuth2
```
2022-10-11 17:01:24 +02:00
Kevin Goslar 15cdb885b5
chore: format using Make (#3257) 2022-09-22 15:56:09 -04:00
aeneasr a364db4ff2 fix: move to v0alpha2 api spec 2022-09-07 08:10:31 +02:00
aeneasr 7893a98038 fix(oauth2): incorrect TTL override 2022-09-07 08:10:31 +02:00
aeneasr 937e6baabf fix: resolve internal SDK regressions 2022-09-07 08:10:31 +02:00
aeneasr c12b45cc44 refactor(oauth2): clean up changes 2022-09-07 08:10:31 +02:00
aeneasr ea4caf7341 refactor(oauth2): rename SDK method from `deleteOAuth2Token` to `adminDeleteOAuth2Token`
BREAKING CHANGE: Rename SDK method from `deleteOAuth2Token` to `adminDeleteOAuth2Token`.
2022-09-07 08:10:31 +02:00
aeneasr 51b58e7ead refactor(oauth2): rename SDK method from `oauth2Token` to `performOAuth2TokenFlow`
BREAKING CHANGE: Rename SDK method from `oauth2Token` to `performOAuth2TokenFlow`.
2022-09-07 08:10:31 +02:00
aeneasr f2bd9a30a9 refactor(oauth2): rename SDK method from `introspectOAuth2Token` to `adminIntrospectOAuth2Token`
BREAKING CHANGE: Rename SDK method from `introspectOAuth2Token` to `adminIntrospectOAuth2Token`.
2022-09-07 08:10:31 +02:00
aeneasr 4e554e7a93 refactor(oauth2): rename SDK method from `userinfo` to `getOidcUserInfo`
BREAKING CHANGE: Rename SDK method from `userinfo` to `getOidcUserInfo`.
2022-09-07 08:10:31 +02:00
aeneasr df467a0605 refactor(oauth2): rename SDK method from `discoverOpenIDConfiguration` to `discoverOidcConfiguration`
BREAKING CHANGE: Rename SDK method from `discoverOpenIDConfiguration` to `discoverOidcConfiguration`.
2022-09-07 08:10:31 +02:00
Grant Zvolsky 0752721dd8 refactor(client): rename SDK methods and introduce `/admin` prefix
BREAKING CHANGE: This release updates SDK services from `public` and `admin` to `v2`. Methods exposed at the admin interface are now prefixed with `admin` (e.g. `adminCreateOAuth2Client`). Administrative endpoints now have an `/admin` prefix (e.g. `POST /admin/clients`). Existing administrative endpoints will redirect to this new prefixed path for backwards compatibility.
2022-09-07 08:10:31 +02:00
aeneasr e466d7c9d2 refactor: `hydra keys` command
BREAKING CHANGE: The `hydra keys create|delete|get|import` commands have changed to follow other Ory project's guidelines, including structured output and improved handling. They are now:

```
hydra create jwks
hydra get jwks
hydra delete jwks
hydra import jwk
```

Please head over to the documentation for more information or use the `--help` CLI flag for each command.
2022-09-07 08:10:31 +02:00
aeneasr 17c226cc2a refactor: remove `/oauth2/flush` endpoint
BREAKING CHANGE: HTTP endpoint `/oauth2/flush`, used to flush inactive access token was deprecated and has been removed. Please use `hydra janitor` instead.
2022-09-07 08:10:31 +02:00
aeneasr 4002224439 refactor(client): make OAuth2 Client IDs system-chosen and immutable
BREAKING CHANGE: To improve security and scalability (in particular sharding), OAuth 2.0 Client IDs can no longer be chosen but are always assigned a random generated UUID V4. OAuth 2.0 Clients created with custom IDs before the v2.0 release will continue working with their legacy Client ID in Ory Hydra v2.x.

Additionally, the `hydra create client` command no longer supports flag `--id` and flag `--callbacks` has been renamed to `--redirect-uris`.

Closes #2911
2022-09-07 08:10:31 +02:00
aeneasr d746fa499a fix: support issuer with and without trailing slash
BREAKING CHANGE: The `iss` (issuer) value no longer appends a trailing slash but instead uses the raw value set in the config.

Setting

```yaml
urls:
  self:
    issuer: https://auth.example.com
```

has changed

```patch
-  "iss": "https://auth.example.com/"
+  "iss": "https://auth.example.com"
```

To set a trailing slash make sure to set it in the config value:

```yaml
urls:
  self:
    issuer: https://auth.example.com/
```

Closes #1482
2022-09-07 08:10:31 +02:00
hackerman 1ab345b9ee fix(sdk): handle all error codes (#3153)
Closes #2350
2022-09-07 08:10:31 +02:00
hackerman c51b21bb23 fix: missing data in JWT grant (#3143)
Co-authored-by: Andreas Krause <a.krause@celonis.com>
2022-09-07 08:10:31 +02:00
aeneasr 0a786b7cd3 fix(jwk): expose correct metadata algorithms 2022-09-07 08:10:31 +02:00
aeneasr 148cadb200 refactor: remove `oauth2.include_legacy_error_fields` config
BREAKING CHANGE: OAuth2 errors can no longer be returned in the legacy error format. Essentially, fields `error_hint`, `error_debug` have been removed. Option `oauth2.include_legacy_error_fields` has been removed.
2022-09-07 08:10:31 +02:00