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-manage...
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,