Commit Graph

66 Commits

Author SHA1 Message Date
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 c43aba3ea4 fix: add missing introspect command 2022-10-27 12:58:45 +02:00
zepatrik cc9d9e5b5d
refactor: make commands easier to consume 2022-10-06 10:54:04 +02:00
aeneasr 2f91ef471c feat: pass options from root 2022-09-07 08:10:31 +02:00
aeneasr 3a263854d8 fix: make servicelocator explicit 2022-09-07 08:10:31 +02:00
aeneasr e934c4f776 feat: improve CLI messages 2022-09-07 08:10:31 +02:00
aeneasr da3e2b4438 refactor: `hydra token introspect` command
BREAKING CHANGE: The `hydra token introspect` command has been renamed to `hydra introspect token` and now supports structured output (JSON, tables, ...).
2022-09-07 08:10:31 +02:00
aeneasr aa338e1789 refactor: `hydra token delete` command
BREAKING CHANGE: The `hydra token delete` command has been renamed to `hydra delete access-tokens` and now supports structured output (JSON, tables, ...).
2022-09-07 08:10:31 +02:00
aeneasr 81e79f2a34 refactor: `hydra token client` command
BREAKING CHANGE: The `hydra token client` command has been renamed to `hydra perform client-credentials` and now supports structured output (JSON, tables, ...).
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 7de78410fc refactor: rename `hydra clients import` command
The `hydra clients import` command now supports reading from STDIN as well as the file system, and ships with output formats such as `json` and `json-pretty`.

BREAKING CHANGE: Command `hydra clients import` is now `hydra import client`.
2022-09-07 08:10:31 +02:00
aeneasr 7482b77c71 refactor: rename `hydra clients update` command
BREAKING CHANGE: Command `hydra clients update` is now `hydra update client`. Additionally, all flags are now singular:

```patch
hydra update client [client-id] \
- --redirect-uris foo --redirect-uris bar \
+ --redirect-uri foo --redirect-uri bar \
- --grant-types foo --grant-types bar \
+ --grant-type foo --grant-type bar \
- --response-types foo --response-types bar \
+ --response-type foo --response-type bar \
- --allowed-cors-origins foo --allowed-cors-origins bar \
+ --allowed-cors-origin foo --allowed-cors-origin bar \
- --post-logout-callbacks foo --post-logout-callbacks bar \
+ --post-logout-callback foo --post-logout-callback bar
```
2022-09-07 08:10:31 +02:00
aeneasr 1c0f971e8b refactor: rename `hydra clients list` command
Renames the command to `hydra list client` and changes CLI flags.

BREAKING CHANGE: Command `hydra clients list` is now `hydra list client`. Please notice that the pagination flags have changed to `--page-token` and `page-size`!
2022-09-07 08:10:31 +02:00
aeneasr dea2fdd005 refactor: rename `hydra clients delete` command
Renames the command to `hydra delete client` and changes CLI flags.

BREAKING CHANGE: Command `hydra clients delete` is now `hydra delete client`.
2022-09-07 08:10:31 +02:00
aeneasr edd4b43d27 refactor: rename `hydra clients get` command
Renames the command to `hydra get client` and changes CLI flags.

BREAKING CHANGE: Command `hydra clients get` is now `hydra get client`.
2022-09-07 08:10:31 +02:00
aeneasr bb9c8ba4f7 feat(cli): significantly improved `create client`
This patch adds output formats to `hydra create client` and makes all client fields configurable as flags.

Closes #3091
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
Andrew Minkin 1b2f6a675e
docs: use Ory instead of ORY in the documentation (#2939) 2022-01-15 17:27:36 +01:00
Nathan Mills c4bc248b3f
fix: add the missing keys import command (#2521)
Closes: #2520
2021-05-10 08:12:15 +02:00
Alano Terblanche f039ebbdf3
feat: flush inactive/expired login and consent requests (#2381)
This patch resolves various table growth issues caused by expired/inactive login and consent flows never being purged from the database.

You may now use the new `hydra janitor` command to remove access & refresh tokens and login & consent requests which are no longer valid or used. The command follows the `notAfter` safe-guard approach to ensure records needed to be kept are not deleted.

To learn more, please use `hydra help janitor`.

This patch phases out the `/oauth2/flush` endpoint as the janitor is better suited for background tasks, is easier to run in a targeted fashion (e.g. as a singleton job), and does not cause HTTP timeouts.

Closes #1574
2021-03-24 20:58:44 +01:00
aeneasr 5af4cef937 test: resolve e2e startup issues 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 bf3be849c0 fix: improve cli flags and add `-c` config flag 2020-10-20 14:55:49 +02:00
aeneasr 6ffa84af36 chore: clean up RootCmd 2020-08-06 00:10:48 +02:00
Patrik 1f6da129a3
fix: resolve bugs in config schema (#1805)
This patch fixes 6 bugs in the config.schema.json and adds "additionalProperties": false where appropriate.

Closes #1804

Co-authored-by: aeneasr <aeneas@ory.sh>
2020-04-17 17:47:27 +02:00
hackerman 9243dc2490
vendor: Fix SQL-regression caused by go 1.12.7 (#1534) 2019-08-19 19:11:44 +02:00
hackerman a0d614fcac
cmd: Reenable -c cli flag (#1345)
Flag -c has accidentally been removed. This patch resolves that. Closes #1344

Signed-off-by: aeneasr <aeneas@ory.sh>
2019-04-08 13:55:51 +02:00
hackerman 513afe0d34
Improve release pipeline and update changelog (#1341)
Signed-off-by: aeneasr <aeneas@ory.sh>
2019-04-02 15:35:59 +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 e2b88d211a cmd: Enable to validate by old system secret (#1249)
* enable to validate by old system secret when setting `ROTATED_SYSTEM_SECRET`
* don't hash when rotated system secret is empty
* add test for rotated system secret getter

Signed-off-by: Shota SAWADA <xiootas@gmail.com>
2019-01-03 11:31:12 +01:00
hackerman 196a85f654
vendor: Upgrade to fosite 0.28.0 (#1172)
This patch enables refresh token expiry.

Closes #1088

Signed-off-by: arekkas <aeneas@ory.am>
2018-11-16 14:47:57 +01:00
hackerman ddafef543c
oauth2: Make client registration endpoint configurable (#1167)
Closes #1072
2018-11-08 17:12:32 +01:00
Amir Aslaminejad f32d1b084b tracing: Add support for tracing DB interactions (#1115)
* tracing: add support for tracing interactions with the database
* tracing: add tests for new BackendConnector options
* tracing:
  • export connector options and hide hydra specific connector options
  • remove config for allowing SQL query args to be included in spans
* tracing: use keyed fields when instantiating TracedBCrypt + helper to determine if Tracing has been configured to DRY up code
* tracing: document the TRACE_ environment variables
* tracing: fixes bug in WithTracing() and adds test coverage
* tracing: add sample tracing configuration in docker-compose

Signed-off-by: Amir Aslaminejad <aslaminejad@gmail.com>
2018-10-26 12:12:49 +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
Amir Aslaminejad 1cd4d17498 core: Add support for distributed tracing (#1019)
Signed-off-by: Amir Aslaminejad <aslaminejad@gmail.com>
2018-09-14 10:28:38 +03:00
arekkas 5292f6c379 cmd: Remove config option
Signed-off-by: arekkas <aeneas@ory.am>
2018-08-27 13:28:16 +02:00
hackerman 93dcbcf3b9
consent: Add logout api endpoint (#984)
Closes #970

Signed-off-by: Michael DeRazon <mderazon@gmail.com>
Signed-off-by: arekkas <aeneas@ory.am>
2018-08-10 11:27:26 +02:00
arekkas 479acd7ea7 consent: Introduce pairwise support
This patch introduces the OpenID Connect pairwise Subject Identifier Algorithm.

Closes #950

Signed-off-by: arekkas <aeneas@ory.am>
2018-08-10 10:23:19 +02:00
arekkas fdd3bb2096 cmd: Introduce subject type algorithm configuration
See #950

Signed-off-by: arekkas <aeneas@ory.am>
2018-08-10 10:23:19 +02:00
arekkas cfee3eb3d0 cmd: Introduce public and administrative ports
This patch introduces two ports, public and administrative. The public
port is responsible for handling API requests to public endpoints such
as /oauth2/auth, while the administrative port handles requests to
JWK, OAuth 2.0 Client, and Login & Consent endpoints.

Closes #904

Signed-off-by: arekkas <aeneas@ory.am>
2018-08-06 11:29:38 +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 215bef3add client: Adds ability to define default client scopes
Environment variable `OIDC_DYNAMIC_CLIENT_REGISTRATION_DEFAULT_SCOPE` was added in order to better implement the OpenID Connect Dynamic Client Registration protocol. The mentioned protocol does not support the concept of whitelisting OAuth 2.0 Scope on a per-client basis. Therefore, the functionality to define the default OAuth 2.0 Scope has been defined.

Keep in mind that exposing the OpenID Connect Dynamic Client Registration functionality to the public effectively disables the OAuth 2.0 Scope whitelisting functionality, as each caller of that API can define which OAuth 2.0 Scope a client may request.

If you decide to expose that functionality, you should NEVER assume that the granted OAuth 2.0 Scope has any meaning when handling requests at your consent endpoint, or when validating requests with tokens issued by the client_credentials flow.
2018-06-24 17:24:12 +02:00
arekkas 0b5f4666d8 cmd: Deprecates connect command and introduces configurable credentials
This patch deprecates the `hydra connect` command as internal
access control has been removed from ORY Hydra and this command
no longer serves any purpose.

Instead, all commands are supplied with environment variables `HYDRA_URL`,
`OAUTH2_CLIENT_ID`, `OAUTH2_CLIENT_SECRET`, `OAUTH2_ACCESS_TOKEN`.

Please check out `hydra help <command>` for usage instructions. You
should also check out the upgrade guide for more detailed upgrade instructions.

This patch also renames some flags and command names which have been
documented in the upgrade guide.

Closes #841
Closes #840
2018-05-04 15:03:26 +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
Aeneas 366ed57d9c
all: Updates license headers (#793) 2018-03-08 10:27:18 +01:00
Aeneas 5c847eac6b
cmd: Resolves an issue with broken build time display (#799)
Previously, the build time was always the current time. This patch
resolves that issue.

Closes #792
2018-03-03 18:04:25 +01:00
Aeneas 40fc5e6af0
oauth2: Prints debug message to logs and evaluate transmitting it to clients too (#727)
Closes #715
2017-12-23 22:21:10 +01:00