Skip to content

Custom mapper for Keycloak which allows to add claims from any REST API

License

Notifications You must be signed in to change notification settings

mwoelke/keycloak-rest-api-mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keycloak REST API Mapper

This custom mapper for keycloak allows querying a URL (e.g. REST API) and add the JSON result as a claim. You can configure the URL, Username/Password for HTTP Basic Auth and a timeout in seconds. Optionally, you may also add the users username in a configurable URL parameter.

If anything fails (network, auth, ...), the claim will not be included.

Note: The result has to be valid JSON!

Setup

This has been tested with Keycloak 21 using the official Quarkus Container and OpenJDK 17.

Compile the source using maven, then copy the resulting JAR into the providers/ folder of your keycloak installation.

Afterwards register the new provider using the keycloak CLI: ./kc.sh build

Shoutouts

This project is heavily based/inspired by the following repos:

https://github.com/mschwartau/keycloak-custom-protocol-mapper-example

https://github.com/dasniko/keycloak-tokenmapper-example

https://github.com/tholst/keycloak-json-graphql-remote-claim

About

Custom mapper for Keycloak which allows to add claims from any REST API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages