-
Notifications
You must be signed in to change notification settings - Fork 41
feat(docs): Document Ory Hydra as OAuth2 provider #843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| --- | ||
| title: Use Ory Hydra as OIDC (OpenID Connect) provider | ||
| --- | ||
|
|
||
| A requirement to run your own Chainloop instance is to configure an OIDC provider to authenticate users who interact with the control plane. | ||
|
|
||
| ## Pre-requisites | ||
|
|
||
| To configure your Chainloop instance with Ory Hydra you'll need the following information: | ||
|
|
||
| - Ory Hydra instance running | ||
| - Access to your OIDC provider configuration | ||
|
|
||
| ## Configure Ory Hydra | ||
|
|
||
| First, you'll need to have an Ory Hydra instance running. You can follow the [official documentation](https://www.ory.sh/hydra/docs/) to set up your own instance. | ||
| Then simply create a new OAuth2 client in your Ory Hydra instance. You can do this by running the following command: | ||
|
|
||
| ```bash | ||
| $ hydra create oauth2-client --name "ACME Solutions" --grant-type authorization_code,refresh_token --response-type code --scope openid,email,profile --redirect-uri http://CHAINLOOP_INSTANCE_URL/auth/callback --endpoint https://ORY_HYDRA_URL | ||
| ``` | ||
|
|
||
| Chainloop client will only request `openid`, `email` and `profile` scopes. | ||
|
|
||
| Relevant information that can be noted from the command signature is: | ||
| - `name`: The name of the OAuth2 client | ||
| - `grant-type`: The grant type of the client it needs to be set `authorization_code` and `refresh_token` | ||
| - `response-type`: The response type of the client: `code` | ||
| - `scope`: The scopes that the client will request: `openid`, `email`, `profile` | ||
| - `redirect-uri`: The redirect URI of the client: Whenever is the Chainloop instance URL plus `/auth/callback` | ||
| - `endpoint`: The endpoint of the Ory Hydra instance | ||
|
|
||
| Once the command is run, it will give back something similar to the following: | ||
|
|
||
| ```bash | ||
| CLIENT ID b028840e-8c54-4d01-91b9-eb2c4aa6fc0e | ||
| CLIENT SECRET REDACTED | ||
| GRANT TYPES authorization_code, refresh_token | ||
| RESPONSE TYPES code | ||
| SCOPE openid email profile | ||
| AUDIENCE | ||
| REDIRECT URIS http://0.0.0.0:8000/auth/callback, http://localhost:8000/auth/callback | ||
| ``` | ||
|
|
||
| ## Configure Chainloop deployment | ||
|
|
||
| As explained in the [deployment guide](../k8s), you can configure the ODIC configuration `oidc` section of the `values.yaml` file. | ||
|
|
||
| Just put the information we gathered from the previous steps like this. | ||
|
|
||
| ```yaml | ||
| controlplane: | ||
| oidc: | ||
| url: "" # Ory Hydra URL | ||
| clientID: "" # Ory Hydra OAuth2 client ID | ||
| clientSecret: "" # Ory Hydra OAuth2 client secret | ||
| ``` | ||
|
|
||
| And deploy your Chainloop Control Plane with the update values to take effect. | ||
|
|
||
| Now your Chainloop instance will automatically authenticating users using the Ory Hydra instance you just configured. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need refresh token? I do not think so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we have on dex?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about dex but Auth0, which we use in prod seems to by default indeed add
refresh_token. I guess it's fine although I do not think we keep any kind of refresh token in the client, we could potentially disable that grant and should be fine.For now, until we test that, I'd leave it as is
Thanks
Update adding link https://auth0.com/docs/get-started/applications/application-grant-types#public-applications