Commit Graph

82 Commits

Author SHA1 Message Date
Patrik bea6b4dd4c feat(hydra): split up persister
GitOrigin-RevId: 203cf926c1613fcbb20393c5b7d0af25c7aecb15
2025-09-17 13:26:01 +00:00
Patrik 8aee364805 fix(hydra): instrument metrics also on public endpoints
GitOrigin-RevId: 84ae1df26bd3d9a025655e50792ea7312f250cca
2025-08-26 13:54:45 +00:00
Philippe Gaultier a147e3b640 feat(changelog): migrate http router to stdlib router
GitOrigin-RevId: ebd7ec330a4f7b9826cb70ba36ba2f727ea64c96
2025-08-19 12:32:40 +00:00
hackerman 63e617630a chore: use un-deprecated WithStack and cmp.Or
GitOrigin-RevId: a9efe036671b711ff9b7b88290ca2c3b93e5dfa3
2025-08-19 09:53:34 +00:00
Patrik 2d28980ded chore: shared serve config
GitOrigin-RevId: 011a5ffc6a6731b28222eeaa72d6bae92b9c0a81
2025-07-18 15:18:55 +00:00
hackerman 0ce9d7a0d4
revert: cpu contention when reading JWKs and suppress generating duplicates (#3876)
This reverts commit d5f65c570a.
2024-11-05 14:54:39 +01:00
Trevor Foster d5f65c570a
fix: cpu contention when reading JWKs and suppress generating duplicate JWKs (#3870)
Previously each concurrent caller would need to lock a shared mutex when reading or writing a given JWK set.
The read path now doesn't require locking a mutex at all and instead returns valid query results directly.

The write path is now protected by a concurrency control mechanism (using x/sync/singleflight) to ensure only one JWK set is generated and persisted.

Note: Duplicate JWK sets may still be improperly generated if running more than one Hydra instance in a high traffic environment.
2024-11-04 15:17:32 +01:00
Jonas Hungershausen c8d5b0e2e6
chore: document custom JWKs in broadcast endpoint (#3793) 2024-07-09 11:19:17 +02:00
Arne Luenser 1d73d83eb0
fix: reject invalid JWKS in client configuration / dependency cleanup and bump (#3603) 2023-08-11 16:33:22 +02:00
Arne Luenser 5bd9002db7
feat: parallel generation of JSON web key set (#3561) 2023-07-05 18:13:16 +02:00
Henning Perl efd9ca7d56
chore: bump deps (#3560) 2023-07-04 10:21:51 +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
Arne Luenser f56e5fad74 fix: append /v2 to module path 2023-01-28 08:40:41 +01:00
Kevin Goslar d768cf6580
docs: standardize license headers (#3216) 2022-11-03 10:10:12 -05:00
aeneasr 06d565ebb7 refactor(sdk): JSON Web Key SDK API
BREAKING CHANGE: SDK naming has changed for the following operations:

```patch
ory.
-   V0alpha2Api.DiscoverJsonWebKeys(context.Background()).
+   WellknownApi.DiscoverJsonWebKeys(context.Background()).
    Execute()

ory.
-   V0alpha2Api.AdminGetJsonWebKeySet(context.Background(), setID).
+	JwkApi.GetJsonWebKeySet(context.Background(), setID).
    Execute()

ory.
-   V0alpha2Api.AdminGetJsonWebKey(context.Background(), setID, keyID).
+   JwkApi.GetJsonWebKey(context.Background(), setID, keyID).
    Execute()

ory.
-   V0alpha2Api.AdminCreateJsonWebKeySet(context.Background(), setID).
-   AdminCreateJsonWebKeySetBody(hydra.AdminCreateJsonWebKeySetBody{
-       Alg: "RS256",
-       Use: "sig",
+   JwkApi.CreateJsonWebKeySet(context.Background(), setID).
+   CreateJsonWebKeySet(hydra.CreateJsonWebKeySet{
+       Alg: "RS256",
+       Use: "sig",
    }).Execute()

ory.
-   V0alpha2Api.AdminUpdateJsonWebKey(context.Background(), setID, keyID).
+   JwkApi.SetJsonWebKey(context.Background(), setID, keyID).
    JsonWebKey(jsonWebKey).Execute()
ory.
-   V0alpha2Api.AdminUpdateJsonWebKeySet(context.Background(), setID).
+   JwkApi.SetJsonWebKeySet(context.Background(), setID).
    JsonWebKeySet(jsonWebKeySet).Execute()

ory.
-   V0alpha2Api.AdminDeleteJsonWebKey(context.Background(), setID, keyID).
    JwkApi.DeleteJsonWebKey(context.Background(), setID, keyID).
    Execute()
ory.
-   V0alpha2Api.AdminDeleteJsonWebKeySet(context.Background(), setID).
    JwkApi.DeleteJsonWebKeySet(context.Background(), setID).
    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 63761357c2 fix: consistently use RS256 in hot reloading 2022-09-07 08:10:31 +02:00
aeneasr cd007bbb49 refactor(jwk): 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. `adminCreateJsonWebKeySet`). Administrative endpoints now have an `/admin` prefix (e.g. `POST /admin/keys`). Existing administrative endpoints will redirect to this new prefixed path for backwards compatibility.
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 ece5ca6a57 fix: improve jwk generator defaults 2022-09-07 08:10:31 +02:00
aeneasr d65aa3a9b6 fix: lazy load PKI 2022-09-07 08:10:31 +02:00
aeneasr bbe0406df6 feat: config hot reloading architecture 2022-09-07 08:10:31 +02:00
Grant Zvolsky 8e961d0eb3 code review 2022-09-07 08:10:31 +02:00
Mart Aarma 7578aa9f3a
feat: Hardware Security Module support (#2625)
This change introduces support for Hardware Security Modules, a physical computing device that safeguards and manages digital keys, performs encryption and decryption functions for digital signatures, strong authentication, and other cryptographic functions.

If enabled, the Hardware Security Module is used to look up any keys. If no key is found, the software module is used as a fallback for lookup. This allows you to use the HSM for privileged keys, and the software module to manage lifecycle keys (e.g. for Token Exchange).

For more information, please [read the guide](https://www.ory.sh/hydra/docs/next/guides/hsm-support).

Thank you to [aarmam](https://github.com/aarmam) for this great contribution!

Co-authored-by: aeneasr <3372410+aeneasr@users.noreply.github.com>
2022-01-11 16:33:22 +01:00
hackerman b12e70c9a0
feat: add method to detect public keys without prefixing (#2758)
Closes #2459
2021-09-21 07:17:18 +02:00
aeneasr 1807e893fd
fix: resolve sdk build issues 2021-07-06 15:22:07 +02:00
aeneasr 428df22c7f chore: clean up viper mentions 2020-12-02 13:37:05 +01:00
aeneasr 8c12b27a59 refactor: replace viper with koanf config management
BREAKING CHANGES: After battling with [spf13/viper](https://github.com/spf13/viper) for several years we finally found a viable alternative with [knadh/koanf](https://github.com/knadh/koanf). The complete internal configuration infrastructure has changed, with several highlights:

1. Configuration sourcing works from all sources (file, env, cli flags) with validation against the configuration schema, greatly improving developer experience when changing or updating configuration.
2. Configuration reloading has improved significantly and works flawlessly on Kubernetes.
3. Performance increased dramatically, completely removing the need for a cache layer between the configuration system and ORY Hydra.
4. It is now possible to load several config files using the `--config` flag.
5. Configuration values are now sent to the tracer (e.g. Jaeger) if tracing is enabled.

Please be aware that deprecated configuration flags have finally been removed with this change. It is also possible that ORY Hydra might complain about an invalid configuration, because the validation process has improved significantly.
2020-12-02 13:37:05 +01:00
aeneasr fdf142cc7c feat: improve error stack trace wrapping 2020-11-17 17:25:54 +01:00
Helmuth Bederna 595e3b0eda
docs: capitalize swagger titles in NYT style (#2023)
See #2015
2020-08-28 15:21:50 +02:00
aeneasr b5c2565122 config: Remove duplicates JWKS IDs from wellknown config
Closes #1413

Signed-off-by: aeneasr <aeneas@ory.sh>
2019-05-02 12:17:35 +02:00
hackerman bbeee653de
Implement OpenID Connect Front-/Backchannel logout (#1376)
Closes #1368 
Closes #1004 
Closes #834

Signed-off-by: aeneasr <aeneas@ory.sh>
2019-04-25 23:17:57 +02:00
hackerman 6829a58622
sdk: Move to go-swagger code generator (#1347)
Signed-off-by: aeneasr <aeneas@ory.sh>
2019-04-09 13:24:13 +02:00
hackerman 95a51deb31
Improve configuration and service management (#1314)
This patch significantly refactors internal configuration and service management with the goal of making configuration changes possible without service restarts. This patch prepares the possibility to configure ORY Hydra from a remote source (etcd, consul) and watch for changes. This patch also introduces the possibility to configure ORY Hydra from a configuration file on top of environment variables.

The following issues have been fixed as well:

- Key rotation of the system secret is now much simpler (closes #1316)
- Database connectivity parameters such as max_conns no longer cause issues with older postgres versions (closes #1327)
- Non-existing routes now return a JSON error instead of `text/plain` when `application/json` was requested (clsoes #1244)
- We now push tags latest, X, X.Y, X.Y.Z to docker hub (closes #1289)
- The quickstart guide no longer builds the source code but instead pulls latest tag (closes #1309)
- We moved to goreleaser and godownloader for release management (closes #1107)
- The quickstart Docker Compose files are now reusable (closes #1196)

The following issues are also resolved:

- Closes #1121 

Signed-off-by: aeneasr <aeneas@ory.sh>
2019-04-02 11:52:21 +02:00
arekkas 700a4a2eff sdk: Use new api groups everywhere 2018-11-18 23:04:10 +01:00
hackerman 89f5960c9a
sdk: Update swagger endpoint definition (#1166)
Closes #1070

Signed-off-by: aeneasr <aeneas@ory.sh>
2018-11-09 14:10:04 +01:00
hackerman 4a8cf84f15
cmd: Add ability to specify consent and login lifespan (#1155)
Closes #1057
2018-11-03 21:15:59 +01:00
JiaLiPassion 1f3a1231c0 cors: Add options cors middleware handler (#1125)
Signed-off-by: JiaLiPassion <JiaLi.Passion@gmail.com>
2018-10-25 17:08:24 +02:00
JiaLiPassion 3466664522 jwks: Enable cors for wellknown endpoints (#1118)
Signed-off-by: JiaLiPassion <JiaLi.Passion@gmail.com>
2018-10-24 15:21:10 +02:00
hackerman 65b7406abe
Move dependencies to ory/x (#1095)
Signed-off-by: aeneasr <aeneas@ory.sh>
2018-10-23 06:59:31 -07:00
Pierre-David Bélanger 85559731db swagger: Fix broken JWK definitions and add Java SDK (#1045)
Signed-off-by: Pierre-David Bélanger <pierredavidbelanger@gmail.com>
2018-09-26 18:25:56 +02:00
Amir Aslaminejad 404bdd711f jwk: update manager to take in context and update all consumers
Signed-off-by: Amir Aslaminejad <aslaminejad@gmail.com>
2018-09-18 09:48:55 +02:00
arekkas e30d48b297 jwk: Expose ./well-known/jwks.json on public port
Signed-off-by: arekkas <aeneas@ory.am>
2018-08-06 16:20:36 +02:00
arekkas c932ab4571 oauth2: Adds JWT Access Token strategy
This patch adds the (experimental) ability to issue JSON Web Tokens instead of ORY Hydra's opaque access tokens. Please be aware that this feature has had little real-world and unit testing and may not be suitable for production.

Simple integration tests using the JWT strategy have been added to ensure functionality.

To use the new JWT strategy, set environment variable `OAUTH2_ACCESS_TOKEN_STRATEGY` to `jwt`. For example: `export OAUTH2_ACCESS_TOKEN_STRATEGY=jwt`.

Please be aware that we (ORY) do not recommend using the JWT strategy for various reasons. If you can, use the default and recommended "opaque" strategy instead.

Closes #248

Signed-off-by: arekkas <aeneas@ory.am>
2018-07-23 17:10:30 +02:00
arekkas 3bbd5e8ab7 jwk: Resolves minor issues in the HTTP handler
Signed-off-by: arekkas <aeneas@ory.am>
2018-07-11 17:28:42 +02:00
aeneasr a463d23ac9 jwk: Adds jwk rotation and improves jwk codebase 2018-06-24 17:24:12 +02:00
arekkas a4d2e73cdd all: Removes access control relics 2018-05-23 18:22:47 +02:00
arekkas 3d0bf0bda5 Removes policy, warden and groups from this project
We have learned a lot over the last year in terms of how ORY Hydra is being used. Initially, we wanted to avoid the problems facing popular databases like MongoDB or others, which did not include authentication for their management APIs.

For this reason, the Warden API was born and primarily used internally and exposed via HTTP. We learned that access control policies are well received, but also add additional complexity to understanding the software. While we firmly believe that these policies implement best practices for access control in complex systems, we do understand that they add a barrier to getting started with ORY Hydra.

For this reason we are planning on moving the Warden API from this project to ORY Oathkeeper or potentially it's own server. We would add a migration path for existing policy definitions to the new service. The default docker image would combine the services in such a way, that ORY Hydra is protected. We would additionally have an (insecure) docker image without authentication which can be used for testing.

This also opens up the possibility of having more access control mechanisms than access control policies. For example, we can add ACL and RBAC and other mechanisms too.

First I think it makes good sense to move this functionality into a separate service and remove the warden calls internally completely. The reason being that not everyone wants to rely on Hydra's access control. Sometimes it's enough to use a gateway in front and require e.g. an API key for management or whatever. New adopters are always baffled by complexity involved with policies and scopes. Removing that from the core could really help. The user survey has also shown that this stuff is quite complex to grasp.

The idea is to have a separate service which is basically ladon as a HTTP API. I think it makes sense to add some functionality to resolve access tokens so it would basically be very similar to the current warden API - probably even equal. There would definitely be some backup mode where hydra's database tables and migrations are used as to make migration as easy as possible.

Then, we would ship docker images and example set ups where different configurations are shown. One of the configurations would be the current one, so basically what we have now in hydra but with the three services combined in one image.

Closes #807
2018-04-29 18:25:42 +02:00