06-13-2017 02:32 PM
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?
06-13-2017 04:42 PM
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();
Explore our Alfresco products with the links below. Use labels to filter content by product module.