docker/dev/keycloak/README.md
Docker compose setup to include Keycloak as identity provider in the local development stack.
In general there should be one client configured per involved application, e.g. openproject and nextcloud.
Clients should usually be configured as follows:
Token exchange needs to be allowed for involved clients. We usually allow this on a per-client basis, i.e. one client (source) is generally allowed to exchange (obtain) tokens for another client (target).
Let's say we want to allow openproject to exchange a nextcloud token:
Things we need to do:
master-realm or realm-management), then Authorization -> PoliciesClient (i.e. the policy matches depending on the client that wants to do something)can-exchange-nextcloud-token) and add to clients openproject and all other names of clients that
should be allowed to exchange a token for the targetPositive, so that the client name matches the policynextcloud), then Permissions -> token-exchangecan-exchange-nextcloud-token policy
Unanimous), since we only define one policy matching
all allowed clients, this will work fineAffirmative instead, so that one matching strategy is enoughAn alternative way to allow a source application to obtain tokens for a target application, is to include the target application among the audience of tokens issued to the source application from the beginning. One way to do this, is by configuring an additional scope that an application can request, to immediately obtain the additional audience.
Let's say we want to allow openproject to use tokens it receives to make API calls to nextcloud:
obtain-nextcloud-audience)Optional (i.e. it will have to be requested by the client explicitly)Mappers -> Add Mapper -> configure a new mapper -> Audiencenextcloud and make sure to select Add to access tokenClients -> name of your source client (e.g. openproject) -> Client scopes -> Add client scope -> name of your client scope (e.g. obtain-nextcloud-audience)