-
Notifications
You must be signed in to change notification settings - Fork 1
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
Uitid/pk 41 keycloak switch #408
Conversation
@@ -81,7 +83,7 @@ Authorization: Bearer YOUR_ACCESS_TOKEN | |||
|
|||
#### More info | |||
|
|||
publiq currently uses [Auth0](https://auth0.com/) as the implementation of its authentication and authorization service. For more in-depth information about requesting client access tokens, see the [Auth0 documentation for the client\_credentials flow](https://auth0.com/docs/flows#client-credentials-flow). | |||
publiq currently uses [Keycloak](https://www.keycloak.org/) as the implementation of its authentication and authorization service. For more in-depth information about requesting client access tokens, see the [OAuth 2.0 specification for the client\_credentials flow](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4). |
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.
Is there any reason why we should communicate that we are using keycloak?
All urls/flows are just oauth compatible, and we do not link to any specific keycloak docs, so I would not give this information away.
This could be valuable info for a hacker with bad intensions.
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.
the reason is simple: Auth0 was mentioned and I changed Auth0 to Keycloak. It's a fair point we don't have to mention it. I'll rephrase.
OTOH it's not a secret (and shouldn't be) that we are using Keycloak. It's obvious in many other ways.
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.
Update: we also have this line: https://github.com/cultuurnet/apidocs/pull/408/files#diff-09205b70e866174fcdc81ff1f865f6208b9149eca7d675d3b0bf4589886034b6R15
So if we don't want to talk about keycloak we have to remove that line as well.
@@ -15,7 +28,7 @@ See [requesting client credentials](./requesting-credentials.md) how to obtain a | |||
|
|||
Additionally, we will need to configure the following settings for your client on our end: | |||
|
|||
* **Login URL**: In some cases the authorization server will need to redirect the user back to a login URL on your application. This URL should point to a route in your application that ends up redirecting to the `/authorize` endpoint on publiq's authorization server, e.g. `https://example.com/login`. Note that it requires `https` and it cannot point to `localhost`. It can include query parameters and a URI fragment. | |||
* **Login URL**: In some cases the authorization server will need to redirect the user back to a login URL on your application. This URL should point to a route in your application that ends up redirecting to the `/realms/uitid/protocol/openid-connect/auth` endpoint on publiq's authorization server, e.g. `https://example.com/login`. Note that it requires `https` and it cannot point to `localhost`. It can include query parameters and a URI fragment. | |||
* **Callback URL(s)**: The absolute URL(s) of the page(s) where your users can be redirected back to after they log in. You can specify any callback URL whenever you redirect a user to the authorization server to log in, but it needs to be registered on our end first to prevent phishing attacks. For example `https://example.com/authorize` for your production application, and/or `https://localhost:8080/authorize` for local development. | |||
* **Logout URL(s)**: The absolute URL(s) of the page(s) where you users can be redirected back to after they log out. You can specify any logout URL whenever you redirect a user to the authorization server to log out, but it needs to be registered on our end first to prevent phishing attacks. For example `https://example.com` if you want to redirect the user back to the homepage of your application after logging out, or `https://example.com/logged-out` if you want to redirect them to a page with a confirmation message like "You're logged out!" after logging out. Like callback URL(s), logout URL(s) may use `https://localhost` for local development. |
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.
Maybe add a line that it is end-slash sensitive ?
Common error.
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.
done
Auth server-->>User: Show login page | ||
User-->>Auth server: Login and give consent | ||
Auth server-->>Client: Redirect back to callback URL with authorization code | ||
Client->>Auth server: POST /oauth/token with authorization code<br /> and client credentials | ||
Client->>Auth server: POST /token with authorization code<br /> and client credentials |
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.
Client->>Auth server: POST /token with authorization code<br /> and client credentials | |
Client->>Auth server: POST /realms/uitid/protocol/openid-connect/token with authorization code<br /> and client credentials |
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.
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.
Changed to full path
|
||
<!-- theme: success --> | ||
|
||
> ##### SDK | ||
> | ||
> If you want, you can use the [Regular Web Application SDK Libraries](https://auth0.com/docs/libraries#webapp) provided by Auth0 to implement this flow. | ||
> It is a good practice to use an OpenID Connect compliant client SDK. SDKs exist in different languages and flavors, so the best choice greatly depends on your specific application. The OpenID.net website contains a list of [certicied](https://openid.net/developers/certified-openid-connect-implementations/) and [uncertified](https://openid.net/developers/uncertified-openid-connect-implementations/) SDKs. To configure your SDK you might need this configuration: `https://account-test.uitid.be/.well-known/openid-configuration`. |
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.
Same remark regarding mentioning Keycloak.
@@ -159,11 +162,11 @@ sequenceDiagram | |||
actor User | |||
User-->>Client: Click login link | |||
Client->>Client: Generate code_verifier and code_challenge | |||
Client->>Auth server: Redirect to GET /authorize with code_challenge | |||
Client->>Auth server: Redirect to GET /auth with code_challenge |
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.
Client->>Auth server: Redirect to GET /auth with code_challenge | |
Client->>Auth server: Redirect to GET /realms/uitid/protocol/openid-connect/auth with code_challenge |
Auth server-->>User: Show login page | ||
User-->>Auth server: Login and give consent | ||
Auth server-->>Client: Redirect back to callback URL with authorization code | ||
Client->>Auth server: POST /oauth/token with authorization code,<br /> client id and code_verifier | ||
Client->>Auth server: POST /token with authorization code,<br /> client id and code_verifier |
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.
Client->>Auth server: POST /token with authorization code,<br /> client id and code_verifier | |
Client->>Auth server: POST /realms/uitid/protocol/openid-connect/token with authorization code,<br /> client id and code_verifier |
@@ -430,9 +419,9 @@ The best way to check if a refresh token is expired is to exchange it for an acc | |||
|
|||
When the user of your application wants to log out, clear any session data in your application including the user's access token and refresh token. If you have cached the [user's info](#user-info), make sure to also clear that. | |||
|
|||
Afterward, you should **redirect** the user to the `/logout` URL on the authorization server so the user's session is also cleared there. This redirect will be invisible to the end user, as the authorization server will simply clear the user's session and then redirect back to your application based on a `?returnTo=...` URL parameter that you can specify. Note that you can only use an allowed "logout URL" as value for the `returnTo` URL parameter. (See [Requirements](#requirements)) | |||
Afterward, you should **redirect** the user to the `/realms/uitid/protocol/openid-connect/logout` URL on the authorization server so the user's session is also cleared there. This redirect will be invisible to the end user, as the authorization server will simply clear the user's session and then redirect back to your application based on a `?post_logout_redirect_uris=...` URL parameter that you can specify. Note that you can only use an allowed "logout URL" as value for the `post_logout_redirect_uris` URL parameter. (See [Requirements](#requirements)) | |||
|
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.
Maybe also add a paragraph about id_token_hint ?
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.
Fair point. It's mentioned in the link behind the link behind OpenID Connect RP-Initiated Logout
in the following paragraph, but I can make it more explicit.
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.
done
Co-authored-by: Koen Eelen <[email protected]>
…pidocs into uitid/PK-41-keycloak-switch
Changed
Ticket: https://jira.uitdatabank.be/browse/PK-41