I'm trying to get the username and password of the currently authenticated user in an Activiti Groovy Script Task. I'm currently using this code:
import org.activiti.engine.impl.identity.Authentication;
out.println("Auth: " + Authentication.getName());
out.println("Auth: " + Authentication.getCredentials().toString());
But it treats Authentication as the class, so getName() returns org.activiti.engine.impl.identity.Authentication and getCredentials() fails to run. I tried using authentication.getName() but that results in a 'No such property: authentication for class...' error.
Any ideas for how I can get this to work?
Assuming you are referring to Alfresco Process Service, you cannot decode a password back, it is a one way algorithm. Alfresco Process Services use PasswordEncoder (Spring Security 4.0.1.RELEASE API) to encode the password and as you can see the only options are to match the stored password (if you know it) or encode a new raw password.
If you want to get the current logged in user, please use
com.activiti.security.SecurityUtils.getCurrentUserObject();
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.