Question

I am using auth-method FORM with apache tomcat to authenticate users. I am using the default j_security_check action.

If a user has signed in, I must display a Sign out link. Else a sign in link. How do I check if the user has signed in?

Also, how do I log a user out?

Was it helpful?

Solution

You can use HttpServletRequest.getUserPrincipal() and check it to find the logged in user.

OTHER TIPS

The state of being logged in is identical to the condition that HttpServletRequest.getUserPrincipal() returns non-null.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top