cancel
Showing results for 
Search instead for 
Did you mean: 

Can I get login user client ip in task listener?

eva_lin
Champ in-the-making
Champ in-the-making
Hello,

I run my process on activiti explorer.

On a user task, I have to get user client ip when task cliamed.

I do this in task listener.

Can I get login user client ip in task listener?

Thanks for your ans.
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
The only way you can get the IP of the user in a place where you can access the HttpRequest. Since Vaadin abstracts this away from you, you should hook into a class where you have access to this. You can override the org.activiti.explorer.ui.login.DefaultLoginHandler (wired in in activiti-standalone-context.xml) and override the method:  public void onRequestStart(HttpServletRequest request, HttpServletResponse response) or even better, the Authenticate(HttpReq…) method.

In this method, you can (for example) return a subclass of the LoggedInUserImpl that has a getter/setter of the IP, which is extracted and set from the HTTPRequest. Another way to store the IP is to use a thread-local which can be statically accessed from the code you have running in the explorer…