Expand my Community achievements bar.

SOLVED

Jackrabbit Preauthentication Module

Avatar

Level 3

Reference: http://jackrabbit.apache.org/oak/docs/security/authentication/preauthentication.html

Hello,

I wanted to login AEM without the password and implemented jackrabbit Preauthentication and facing an issue. Developed a custom authentication handler which implementes org.apache.sling.auth.core.spi.AuthenticationHandler and in extract credentials method, set the authentication info with the user id i received from the servlet.

And also developed a custom login module which extends org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule class and implemented the login() method. As per documentation i have set the login name, credentials and pre auth login. And then navigated to felix configurations and added new Apache Felix JAAS Configuration factory with the custom login java class name and other details.

When i try to login, i see username is properly set in custom authentication handler and my custom login module is not being called. I am getting below error message in logs. Custom java class is installed as part of bundle but, still getting an error

org.apache.sling.auth.core.impl.SlingAuthenticator handleLoginFailure: Unable to authenticate <user>: java.lang.AssertionError: No bundle exists to create LoginModule from <custom login java class>
    at org.apache.felix.jaas.internal.BundleLoginModuleCreator.newInstance(BundleLoginModuleCreator.java:59)
    at org.apache.felix.jaas.internal.ConfigLoginModuleProvider.createLoginModule(ConfigLoginModuleProvider.java:80)
    at org.apache.felix.jaas.boot.ProxyLoginModule.initialize(ProxyLoginModule.java:46)

...............................

........ com.day.cq.auth.impl.LoginSelectorHandler requestCredentials: Abort login due to apparent misconfiguration.
........ com.day.cq.auth.impl.LoginSelectorHandler requestCredentials: Possible reasons: login page not existing or not accessible

 

 

Appreciated for any help on above

1 Accepted Solution

Avatar

Correct answer by
Level 10

Steps would be

1. Create a SimpleCredential instance which can be handled by your LoginModule

2. That credential instance needs to be passed as part of AuthenticationInfo that is returned by the AuthenticationHandler

3. Have your AuthenticationHandler also implement the Sling AuthenticationFeedbackHandler. There as part of authenticationSucceeded call you need to perform steps similar to what is done in TokenAuthenticationHandler. Basically you need to get a TokenCookie issued based on that token.

followed all the step Still issue file a support case with adobe daycare team. 

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Steps would be

1. Create a SimpleCredential instance which can be handled by your LoginModule

2. That credential instance needs to be passed as part of AuthenticationInfo that is returned by the AuthenticationHandler

3. Have your AuthenticationHandler also implement the Sling AuthenticationFeedbackHandler. There as part of authenticationSucceeded call you need to perform steps similar to what is done in TokenAuthenticationHandler. Basically you need to get a TokenCookie issued based on that token.

followed all the step Still issue file a support case with adobe daycare team. 

Avatar

Level 3

Hi Sham,

I have my resoved my previous error create LoginModule from <custom login java class>
    at org.apache.felix.jaas.internal.BundleLoginModuleCreator.newInstance(BundleLoginModuleCreator.java:59),

As per http://grepcode.com/file/repo1.maven.org/maven2/org.apache.felix/org.apache.felix.jaas/0.0.2/org/apa... documentation, custom bundle need to have a property called Jaas-ModuleClass which is used to load the login module from bubdle. Jass-Moduleclass is part of manifest.mf of oak-core jar, that the reason default login modules are loaded

Jaas-ModuleClass: org.apache.jackrabbit.oak.spi.security.authentication.
 GuestLoginModule,org.apache.jackrabbit.oak.security.authentication.user
 .LoginModuleImpl,org.apache.jackrabbit.oak.security.authentication.toke
 n.TokenLoginModule

 

When generating the bundle, i have added the following to manifest.mf. "Jaas-ModuleClass: <custom login module which extends abstract login module>"

My previous error got resolved, but i am getting a below error when i try to login to AEM

 *INFO*  org.apache.sling.auth.core.impl.SlingAuthenticator handleLoginFailure: Unable to authenticate <custom user id which is received from servlet>: Login Failure: all modules ignored
*INFO* org.apache.sling.auth.core.impl.SlingAuthenticator handleLoginFailure: Unable to authenticate <custom user id which is received from servlet>: Login Failure: all modules ignored
 *ERROR* com.day.cq.auth.impl.LoginSelectorHandler requestCredentials: Abort login due to apparent misconfiguration.
*ERROR*  com.day.cq.auth.impl.LoginSelectorHandler requestCredentials: Possible reasons: login page not existing or not accessible

Avatar

Level 1

hi I am trying to do something similar .....

can you please help me