[keycloak-user] custom ldap attribute mapper
Kevin Hirschmann
khirschmann at huebinet.de
Wed Jan 3 10:15:27 EST 2018
Hello,
I would like to add my own custom user-attribute-ldap-mapper. It is needed, because the usernames, groups and roles of a test environment are prefixed to distinguish them from production usernames etc. .
First I took the example "user-storage-simple" which worked right away.
Now I transfered this to ldap mappers. I created a maven project, added
a) A class org.keycloak.examples.ldap.mappers.XxMapperFactory
b) a file org.keycloak.storage.ldap.mappers.LDAPStorageMapperFactory and added to it the entry org.keycloak.examples.ldap.mappers.XxMapperFactory
c) I added a jboss-deployment-structure.xml file
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.keycloak.keycloak-server-spi-private" />
</dependencies>
</deployment>
</jboss-deployment-structure>
I added the jboss-deployment-structure.xml because I found this https://issues.jboss.org/browse/KEYCLOAK-4428 which
matches my problem
INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0027: Starting deployment of "ldap-mapper-example.jar" (runtime-name: "ldap-mapper-example.jar")
WARN [org.jboss.as.dependency.private] (MSC service thread 1-6) WFLYSRV0018: Deployment "deployment.ldap-mapper-example.jar" is using a private module ("org.keycloak.keycloak-server-spi-private:main") which may be changed or removed in future versions without notice.
WARN [org.jboss.modules] (MSC service thread 1-6) Failed to define class org.keycloak.examples.ldap.mappers.XxMapperFactory in Module "deployment.ldap-mapper-example.jar:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link org/keycloak/examples/ldap/mappers/XxMapperFactory (Module "deployment.ldap-mapper-example.jar:main" from Service Module Loader): org/keycloak/storage/ldap/mappers/LDAPConfigDecorator
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:605)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at org.keycloak.provider.DefaultProviderLoader.load(DefaultProviderLoader.java:47)
at org.keycloak.provider.ProviderManager.load(ProviderManager.java:93)
at org.keycloak.services.DefaultKeycloakSessionFactory.loadFactories(DefaultKeycloakSessionFactory.java:206)
at org.keycloak.services.DefaultKeycloakSessionFactory.deploy(DefaultKeycloakSessionFactory.java:112)
at org.keycloak.provider.ProviderManagerRegistry.deploy(ProviderManagerRegistry.java:42)
at org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor.deploy(KeycloakProviderDeploymentProcessor.java:54)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
But it didn't help (why would I write this mail if it did).
What have I missed?
Thx
Kevin
More information about the keycloak-user
mailing list