[keycloak-user] Could not find class org.keycloak.adapters.jaas.BearerTokenLoginModule

Christian Froehlich christian.froehlich at agfa.com
Fri Jan 6 09:06:43 EST 2017


Hello,

I try to use the login module 
"org.keycloak.adapters.jaas.BearerTokenLoginModule" and I just get it 
running when I add the module as “global module” in my standalone.xml. 
What I did to secure my wildfly in detail:
-> Install the keycloak wildfly adapter to my application server
-> Add the login module to my security domain: 
<login-module code="org.keycloak.adapters.jaas.BearerTokenLoginModule" 
flag="sufficient" module="org.keycloak.keycloak-adapter-core">
<module-option name="keycloak-config-file" 
value="${jboss.server.config.dir}/keycloak.json"/>
</login-module>
When I try to login, the login fails and I see the following log in my 
server.log (see below). I also get the error when I remove the module 
attribute from the login-module element. I only get it running when I 
define the “org.keycloak.keycloak-adapter-core” module as a global module. 
Do you have any idea what’s going wrong? I normally expect that the 
LoginModule is found without defining it as global module.

DEBUG [org.jboss.security] (default task-10) () PBOX00206: Login failure: 
javax.security.auth.login.LoginException: LoginModule-Klasse kann nicht 
gefunden werden: org.keycloak.adapters.jaas.BearerTokenLoginModule from 
[Module "deployment.orbis-framework.war:main" from Service Module Loader]
        at 
javax.security.auth.login.LoginContext.invoke(LoginContext.java:794)
        at 
javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
        at 
javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
        at 
javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
        at 
javax.security.auth.login.LoginContext.login(LoginContext.java:587)
        at 
org.jboss.security.authentication.JBossCachedAuthenticationManager.defaultLogin(JBossCachedAuthenticationManager.java:406)
        at 
org.jboss.security.authentication.JBossCachedAuthenticationManager.proceedWithJaasLogin(JBossCachedAuthenticationManager.java:345)
        at 
org.jboss.security.authentication.JBossCachedAuthenticationManager.authenticate(JBossCachedAuthenticationManager.java:323)
        at 
org.jboss.security.authentication.JBossCachedAuthenticationManager.isValid(JBossCachedAuthenticationManager.java:146)
        at 
org.wildfly.extension.undertow.security.JAASIdentityManagerImpl.verifyCredential(JAASIdentityManagerImpl.java:123)
        at 
org.wildfly.extension.undertow.security.JAASIdentityManagerImpl.verify(JAASIdentityManagerImpl.java:94)
        at 
io.undertow.security.impl.BasicAuthenticationMechanism.authenticate(BasicAuthenticationMechanism.java:167)
        at 
io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:245)
        at 
io.undertow.security.impl.SecurityContextImpl$AuthAttempter.transition(SecurityContextImpl.java:263)
        at 
io.undertow.security.impl.SecurityContextImpl$AuthAttempter.access$100(SecurityContextImpl.java:231)
        at 
io.undertow.security.impl.SecurityContextImpl.attemptAuthentication(SecurityContextImpl.java:125)
        at 
io.undertow.security.impl.SecurityContextImpl.authTransition(SecurityContextImpl.java:99)
        at 
io.undertow.security.impl.SecurityContextImpl.authenticate(SecurityContextImpl.java:92)
        at 
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:55)
        at 
io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at 
io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
        at 
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
        at 
io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
        at 
io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
        at 
io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
        at 
io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
        at 
io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
        at 
io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at 
org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at 
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at 
io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
        at 
io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
        at 
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
        at 
io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
        at 
io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
        at 
io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
        at 
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at 
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at 
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at 
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at 
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at 
io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
        at 
io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
        at 
io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
        at 
io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
        at 
io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
        at 
io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

Regards and thanks in advance
Christian


More information about the keycloak-user mailing list