Skip to content

Improve Compose Keycloak config#4626

Open
mnonnenmacher wants to merge 4 commits intomainfrom
keycloak-config
Open

Improve Compose Keycloak config#4626
mnonnenmacher wants to merge 4 commits intomainfrom
keycloak-config

Conversation

@mnonnenmacher
Copy link
Contributor

Switch to the client credentials flow for the backend and do some cleanups for the Keycloak config use in Compose. See the commit messages for details.

There will be a follow-up PR which reworks the remaining clients and (finally) adds documentation for the Keycloak configuration required by ORT Server.

The file was first introduced in 6b34a66, but it was never used, because
`configManager.allowSecretsFromConfig` defaults to `true`. In this case,
environment variables and default values from `application.conf` files
take precedence over the secret provider.

To fix this, set `allowSecretsFromConfig` to `false` in which case
secrets will only be read from the `secrets.properties` file. This also
requires fixing the property names for the database credentials in
`secrets.properties`.

Also remove all environment variables for credentials from the Docker
Compose config because they are not required anymore.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@doubleopen.org>
This minimizes the diff in the following commit.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@doubleopen.org>
Add a new Keycloak client `ort-server-backend` and use it for the
backend to communicate with Keycloak. The new client only uses the
"Service account roles" authentication flow which corresponds to the
"Client Credentials Grant" [1] from OAuth2. The associated service
account has the admin role for the realm.

This is the recommended authorization flow for machine to machine
communication [2], because it authorizes an application instead of a
user.

[1]: https://datatracker.ietf.org/doc/html/rfc6749#section-4.4
[2]: https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@doubleopen.org>
The role is not required anymore since role management was moved to the
database [1]. The superuser group is still required to bootstrap the
superusers, as the migration logic that assigns the superuser roles in
the database is based on the Keycloak groups.

[1]: #3908

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@doubleopen.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant