[keycloak-user] Add custom protocol mapper

Edgar Vonk - Info.nl Edgar at info.nl
Tue Feb 16 03:37:11 EST 2016


Ah, clear. Thanks a lot! That is exactly what we were looking for.


> On 15 Feb 2016, at 17:31, Bill Burke <bburke at redhat.com> wrote:
> 
> Search documentation for how to add a provider.  It works the same for protocol mapper.  You just need to have that /META-INF/services file in the jar that contains your mapper classes.  You deploy that jar, and it should work.  Again, there is documentation for other SPIs, packaging would work the same for protocol mapper.
> 
> On 2/15/2016 11:03 AM, Edgar Vonk - Info.nl wrote:
>> Thanks Bill! We found this out indeed and managed to create our own mapper as a spike. Creating the Java class is easy enough and fine as it is. You also need to add the mapper to the list of available mappers in:
>> https://github.com/keycloak/keycloak/blob/master/services/src/main/resources/META-INF/services/org.keycloak.protocol.ProtocolMapper
>> 
>> Our challenge now lies in how to integrate these code changes into our (Docker based) build proces. Ideally we do not want to have to build Keycloak itself from source code. We really only want to build our custom mapper and somehow add it to the Keycloak distribution if at all possible. The Java class is the easy part I guess, but adding the mapper definition to the META-INF file seems a little harder.
>> 
>> cheers
>> 
>> 
>>> On 15 Feb 2016, at 16:39, Bill Burke <bburke at redhat.com> wrote:
>>> 
>>> There is an SPI, but it is unpublished.  I haven't had time to polish it
>>> or document it.  You can use it, but we can't guarantee it won't change.
>>> 
>>> https://github.com/keycloak/keycloak/tree/master/services/src/main/java/org/keycloak/protocol/oidc/mappers
>>> 
>>> 
>>> 
>>> On 2/15/2016 8:10 AM, Edgar Vonk - Info.nl wrote:
>>>> Hi,
>>>> 
>>>> We want to write our own custom protocol mapper where we add custom dynamic user attributes to the JWT tokens by querying our custom database.
>>>> 
>>>> However if I not mistaken there is no SPI for adding custom mappers? How would we go about adding our own protocol mapper most easily?
>>>> 
>>>> cheers
>>>> 
>>>> Edgar
>>>> _______________________________________________
>>>> keycloak-user mailing list
>>>> keycloak-user at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>>> -- 
>>> Bill Burke
>>> JBoss, a division of Red Hat
>>> http://bill.burkecentral.com
>>> 
>>> _______________________________________________
>>> keycloak-user mailing list
>>> keycloak-user at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/keycloak-user
> 
> -- 
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
> 




More information about the keycloak-user mailing list