Skip to content

A Keycloak token mapper to map Groups and Properties into tokens

License

Notifications You must be signed in to change notification settings

5-stones/keycloak-group-tokenmapper

Repository files navigation

Keycloak OIDC protocol token Group mapper

This token mapper allows for the mapping of user group data into the token. It includes granular control of what properties from the group object you want to map.

Screen Shot

Installation

Installation of the plugin consists of obtaining the .jar file and doing one of the following:

  1. Quarkus - copy the .jar into your providers directory.
  2. WildFly - copy the .jar into your standalone/deployments directory.

Then rebuild/restart keycloak.

Download The .jar

Each GitHub release has the build artifact uploaded to it. You can manually download it and install it by going to the Release and downloading the artifact.

If you want to automate it you can do the following:

export VERSION=some_version
wget "https://github.com/5-stones/keycloak-group-tokenmapper/releases/download/v$VERSION/com.weare5stones.keycloak.tokenmapper-group-$VERSION.jar"

Or in your Dockerfile:

ENV TOKEN_MAPPER_VERSION=some_version
ADD --chown=keycloak:keycloak \
  "https://github.com/5-stones/keycloak-group-tokenmapper/releases/download/v$TOKEN_MAPPER_VERSION/com.weare5stones.keycloak.tokenmapper-group-$TOKEN_MAPPER_VERSION.jar" \
  /opt/keycloak/providers/

NOTE: ADD is used above as modern quay.io:keycloak\keycloak base images don't have a package manager bundled with them.

Clone And Build The .jar

  1. Clone the repository
  2. From the root of the repository run:
    mvn clean install
    

The built .jar will be available in the root of the target folder.

Release

The standard release command for this project is:

yarn version

This command will:

  1. Generate/update the Changelog
  2. Bump the package version
  3. Tag & pushing the commit

e.g.

yarn version --new-version 1.2.17
yarn version --patch // 1.2.17 -> 1.2.18

Why Yarn?

Why are we using yarn on a Java project? Because we have standard tooling around Changelog generation and release based around commitizen and conventional-changelog. And we do what we want.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

About

A Keycloak token mapper to map Groups and Properties into tokens

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published