Enable auto-login to user in CQ author environment(5.6.1) as per the user id | Community
Skip to main content
Level 2
October 16, 2015
Solved

Enable auto-login to user in CQ author environment(5.6.1) as per the user id

  • October 16, 2015
  • 1 reply
  • 1091 views

I am trying to fetch the user password using the user id to enable auto-login to CQ author environment.

Below is what i have been trying:

Session jcrSession = resourceResolver.adaptTo(Session.class); UserManager userManager = AccessControlUtil.getUserManager(jcrSession); Authorizable authorizable = userManager.getAuthorizable(USER_ID); User user = null; if (authorizable instanceof User) { user = (User)authorizable; } SimpleCredentials credential = (SimpleCredentials)user.getCredentials(); char[] password = credential.getPassword(); out.println("Password: " + password);

I get a an exception at line 8.

java.lang.ClassCastException: org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentials cannot be cast to javax.jcr.SimpleCredentials

I know the password for a user is hashed in CQ but was trying this as suggested on an earlier post @ http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__69oi-hi_we_have_forgo.html 

Please suggest if retrieving password is not possible, is there a way to implement a custom authentication handler in CQ author env that covers all scenarios as in the default Login selector handler.

Thanks,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by PaulMcMahon

Try casting to CryptedSimpleCredentials instead of SimpleCredentials

1 reply

PaulMcMahonAccepted solution
Level 8
October 16, 2015

Try casting to CryptedSimpleCredentials instead of SimpleCredentials