Commit Graph

54 Commits

Author SHA1 Message Date
Arne Luenser 38efece55b
fix: migrations on CockroachDB v25+ (#3994)
I've added some output to the generated migrations files to make them
easier to recreate, hence the big diff.

These are important:

```
persistence/sql/migrations/20211004110001000000_change_client_primary_key.cockroach.down.sql
persistence/sql/migrations/20211004110001000000_change_client_primary_key.cockroach.up.sql
persistence/sql/migrations/20211004110003000000_change_client_primary_key.cockroach.down.sql
persistence/sql/migrations/20211004110003000000_change_client_primary_key.cockroach.up.sql

persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.cockroach.down.sql
persistence/sql/migrations/20211011000001000000_change_jwk_primary_key.cockroach.up.sql
persistence/sql/migrations/20211011000003000000_change_jwk_primary_key.cockroach.down.sql
persistence/sql/migrations/20211011000003000000_change_jwk_primary_key.cockroach.up.sql

persistence/sql/src/20220210000001_nid/20220210000001000000_nid.cockroach.up.sql
```

Closes #3964 
Supersedes #3993 (thanks @hperl)
2025-05-20 08:56:06 +02:00
hackerman d27882faf1
feat: add migrate sql up|down|status (#3894)
This patch adds the ability to execute down migrations using:

```
hydra migrate sql down -e --steps {num_of_steps}
```

Please read `hydra migrate sql down --help` carefully.

Going forward, please use the following commands

```
hydra migrate sql up ...
hydra migrate sql status ...
```

instead of the previous, now deprecated

```
hydra migrate sql ...
hydra migrate status ...
```

commands.

See https://github.com/ory-corp/cloud/issues/7350
2024-11-27 14:14:13 +01:00
Arne Luenser 8900cbb770
feat: allow additional SQL migrations (#3587) 2023-08-03 12:28:58 +02:00
Arne Luenser 749eb8db40
feat: add `hydra migrate status` subcommand (#3579) 2023-07-25 09:52:41 +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 3a263854d8 fix: make servicelocator explicit 2022-09-07 08:10:31 +02:00
aeneasr 46b5887464 refactor: deprecate `--dangerous-allow-insecure-redirect-url` flag
BREAKING CHANGE: CLI flag `--dangerous-allow-insecure-redirect-url` has been removed. Please use the `--dev` flag instead!
2022-09-07 08:10:31 +02:00
aeneasr e2526547b1 feat(cli): improve migrate command handling 2022-09-07 08:10:31 +02:00
aeneasr 68cb7d511f fix: compile issues 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 05eaf6d3be feat: switch to otelx (#3108) 2022-09-07 08:10:31 +02:00
Grant Zvolsky 8e961d0eb3 code review 2022-09-07 08:10:31 +02:00
Grant Zvolsky b7fc2bff53 feat: implement NID 2022-09-07 08:10:31 +02:00
Grant Zvolsky a2c5e14204 feature: create networks table 2022-09-07 08:10:31 +02:00
Grant Zvolsky 53862f290c refactor: improve performance and reduce data use of consent persistence layer (#2836)
This patch changes the internal data structure and reduces four (sort of redundant) tables into one. As part of this change, a few new tools have been added:

* Introduce the `hydra sql gen` command and a convenience Make target with autocompletion. The command reads migration templates from a source directory and produces migration files in a target directory. Its main function is to split a single source file into multiple files using split marks.

* Introduce the `hack/db-diff.sh` command to generate database schema diffs at different commits. This script is used to view and review the impact of migrations on the database schema.

BREAKING CHANGES: This patch merges four SQL Tables into a new table, deleting the old tables in the process. The migrations in this patch are expected to be applied offline. Please be aware that *there are no down migrations*, and if something goes wrong, data loss is possible. Always back up your database before applying migrations. For more information, see [Hydra 2.x Migration Guide](https://www.ory.sh/hydra/docs/guides/migrate-v2).

Rows with NULL login_challenge in `hydra_oauth2_consent_request` and corresponding `hydra_oauth2_consent_request_handled` are deleted as a side effect of the merge migration. This is done with the assumption that only a very small number of sessions, issued by pre-1.0 Hydra, will be affected. Please contact us if this assumption doesn't apply or if the deletion adversely affects your deployment.

Signed-off-by: Grant Zvolsky <grant@zvolsky.org>
2022-09-07 08:10:31 +02:00
aeneasr 6fa591c849 feat: move to go 1.16 and static embed files 2021-03-08 17:24:00 +01:00
hackerman 4937a00b9a
fix: bump ory/x and update config usage (#2248) 2020-12-15 13:55:30 +01: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
hackerman 5097805473
fix: bump pop to v5.2 (#1922)
Closes #1892
2020-06-22 16:22:40 +02:00
aeneasr fdb3231e19 fix: resolve dependency issues and adopt logrusx logger 2020-05-28 14:35:37 +02:00
Patrik 0bd0b0dd35
refactor: moved AskForConfirmation to ory/x/cmdx (#1848)
Co-authored-by: aeneasr <aeneas@ory.sh>
2020-05-09 12:34:06 +02:00
hackerman 94057d9400
refactor: move migrations to gobuffalo/fizz (#1775)
This patch deprecates the previous migration system (sql-migrate) in favor of gobuffalo/fizz. No functional changes have been made.

BREAKING CHANGES: Please run `hydra migrate sql` before applying this release.
2020-04-30 10:58:57 +02:00
hackerman d112c72e16
cli: Resolve Go 1.12.7 regression in migrate sql (#1565) 2019-09-18 18:31:15 +02:00
hackerman 9243dc2490
vendor: Fix SQL-regression caused by go 1.12.7 (#1534) 2019-08-19 19:11:44 +02:00
David f8f23630d8 all: add CockroachDB support (#1348)
Closes #1326 

Signed-off-by: David López <not4rent@gmail.com>
2019-05-10 13:18:19 +02:00
aeneasr a4a27179d9 cmd: Add migration planning
Closes #1139

Signed-off-by: aeneasr <aeneas@ory.sh>
2019-04-27 10:45:49 +02:00
hackerman a4a75d4368
Improve e2e test performance (#1392)
Closes #1389

Signed-off-by: aeneasr <aeneas@ory.sh>
2019-04-26 18:39:37 +02:00
hackerman cb2ad555ce
oauth2: Allow whitelisting insecure redirect URLs (#1354)
This patch enables developers to whitelist insecure redirect URLs while using flag `--dangerous-force-http`.

Closes #1021

Signed-off-by: aeneasr <aeneas@ory.sh>
2019-04-11 20:39:57 +02:00
Sawada Shota f964c69f07 docs: Fix environment variable DATABASE_URL to DSN (#1343)
Signed-off-by: Shota Sawada <xiootas@gmail.com>
2019-04-04 10:35:45 +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
Sawada Shota e2d6c44635 cmd: Ffix error message of too short new system secret (#1248)
Signed-off-by: Shota SAWADA <xiootas@gmail.com>
2018-12-27 10:39:58 +01:00
prateek1192 18ae84e9f7 cmd: Properly document secret rotation (#1195)
Signed-off-by: Prateek Arora <1192prateek@gmail.com>
2018-12-07 16:18:58 +01:00
arekkas e152f75bee cmd: Force migration order
See #1131

Signed-off-by: arekkas <aeneas@ory.am>
2018-11-18 23:04:28 +01:00
hackerman 94dae2293c
cmd: Resolve panic in migration handler (#1151)
Closes #1137

Signed-off-by: aeneasr <aeneas@ory.sh>
2018-11-03 12:55:16 +01:00
hackerman 3a10df9bff
oauth2: Add OAuth2 audience claim and improve migrations (#1145)
This patch adds the ability to whitelist and request an audience
when performing any OAuth 2.0 Flow. The audience is useful in multi-
tenant environments where access tokens should be restricted to certain
resources.

Closes #883
Closes #1144

Signed-off-by: arekkas <aeneas@ory.am>
2018-11-02 16:46:01 +01:00
hackerman c8104f4a43
cmd: Resolve issues with secret migration (#1129)
This patch resolves an issue which made it impossible to rotate secrets because an un-hashed version was used.

Closes #1026

Signed-off-by: arekkas <aeneas@ory.am>
2018-10-26 17:51:00 +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
arekkas 57378ed8da cli: Improve migrate error messages
Closes #1026

Signed-off-by: arekkas <aeneas@ory.am>
2018-10-09 23:53:03 +02:00
hackerman 2b491c9e27
Switch to go modules and add vendor (#1077)
Closes #1074

Signed-off-by: arekkas <aeneas@ory.am>
2018-10-09 22:45:56 +02:00
arekkas 929cbe55ff jwk: Add ability to rotate SYSTEM_SECRET
Closes #73

Signed-off-by: arekkas <aeneas@ory.am>
2018-08-27 13:28:16 +02:00
arekkas 00fd517fbf oauth2: Removes tokens when consent is revoked
Closes #856

Signed-off-by: arekkas <aeneas@ory.am>
2018-07-07 14:49:16 +02:00
Aeneas 6ba64e4f70
cmd: Allows reading database from env in migrate sql (#898)
Closes #896
2018-06-03 16:40:46 +02:00
arekkas a002e30577 oauth2: Improves the consent flow design
This patch makes significant changes to the consent flow. First,
the consent flow is being renamed to "User Login and Consent Flow"
and is split into two redirection flows, the "User Login Redirection Flow"
and the "User Consent Flow".

Conceptually, not a lot has changed but the APIs have been cleaned up
and the new flow is a huge step towards OpenID Connect Certification.

Besides easier implementation on the (previously known as) consent app,
this patch introduces a new set of features which lets ORY Hydra
detect previous logins and previously accepted consent requests. In turn,
the user does not need to login or consent on every OAuth2 Authorize Code
Flow.

This patch additionally lays the foundation for revoking tokens per
user or per user and client.

Awesome.

Closes #771
Closes #772
2018-05-04 14:07:36 +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
Aeneas 366ed57d9c
all: Updates license headers (#793) 2018-03-08 10:27:18 +01:00
Aeneas dcbd6d8fcb
Add license header to all source files (#644)
Closes #643
2017-11-06 13:01:53 +01:00
arekkas 87b893e77f jwk: implement swagger-based sdk 2017-10-05 18:12:34 +02:00