-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
Right now the tenant-specifc web-app application-type will be ignored unless a default configuration is provided.
For example, configuring only:
quarkus.oidc.tenant-1.auth-server-url=${keycloak.url}/realms/quarkus
quarkus.oidc.tenant-1.application-type=web-app
quarkus.oidc.tenant-1.client-id=quarkus-app
quarkus.oidc.tenant-1.credentials.secret=secret
will log a warning that quarkus.oidc.tenant-1.application-type property is not supported.
The reason for that is that the application-type property is a build time property and as such it is not available at the moment the tenant configuration is resolved. And because a service type is a default value, only the Bearer mechanism would be registered at the deployment time.
So for the code-flow to work with the multi-tenancy, one needs to have a default configuration even if it is not used:
# Default config just to make the Tenant specific configuration work in the code flow mode
quarkus.oidc.auth-server-url=${keycloak.url}/realms/quarkus
quarkus.oidc.application-type=web-app
# Tenant 1 configuration
quarkus.oidc.tenant-1.auth-server-url=${keycloak.url}/realms/quarkus
# Tenant 2 configuration
quarkus.oidc.tenant-2.auth-server-url=${keycloak.url}/realms/quarkus
#etc
Implementation ideas
- Make
applicatiion-typea runtime property - Instead of registering either Bearer or CodeFlow authentication mechanism at the deployment time, register a composite
OidcAutenticationMechanismwhich will have both of those authentication mechanisms available and delegate to the right one depending on whatever the resolved context's application type is.
This way we will also be able to support an application which can act both as a service and a web-app application.