How to get the username of the actual authenticating user in a Java Service Task?
User currentUser = SecurityUtils.getCurrentUserObject();
Note that the SecurityUtils class is only available on the classpath of the UI application.
@joram I want to get User session outside of the UI classpath and it is always returning null as expected.
Another workaround is to get initiator variable from execution and query the identity service with that information to list user details but this is not a secure way since someone may override this initiator variable from Script Task and pretend to be that user. So what is the secure way of doing this?