[keycloak-dev] ProtocolMapper SPI NoClassDefFound on interfaces & abstract classes

Thomas Dupont (UGent-imec) Thomas.Dupont at UGent.be
Fri Apr 27 07:43:18 EDT 2018


Hi,

I am currently implementing a custom ProtocolMapper for OIDC. The idea is that it can gather the value of an attribute field per group and add it to the token as an object indexed by group (for all groups the user is member of). eg. {myclaim: { group1: val1##val2, group2: val2##val3}}
I implemented a SimpleMapper class (implementing ProtocolMapper) and added the necessary META-INF/services/org.keycloak.protocol.ProtocolMapper file with the FQN of my class.
Deploying this works, and I can select the mapper in the keycloak mapping section.

If however I want my class to implement extra interfaces (like ) and extend org.keycloak.protocol.oidc.mappers.AbstractOIDCProtocolMapper, I get a NoClassDefFound in the logs of keycloak when deploying. The same issue arises when I want to use org.keycloak.protocol.oidc.mappers.OIDCAttributeMapperHelper in this class.

My dependencies in pom.xml are as follows (keycloak.version = 4.0.0.Beta1):

<dependencies>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-core</artifactId>
        <version>${keycloak.version}</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-server-spi</artifactId>
        <version>${keycloak.version}</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-server-spi-private</artifactId>
        <version>${keycloak.version}</version>
    </dependency>
    <dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-services</artifactId>
        <version>${keycloak.version}</version>
    </dependency>
</dependencies>

How can I implement from those interfaces, extend from that class or use the helper class? Am I missing something here? Any help is greatly appreciated!



More information about the keycloak-dev mailing list