0

How can I check whether a certain user is already signed into my application? I want to do this so I can redirect someone that tries to login using the same username to logout.

FYI: I use appfuse project generator.

TylerH
  • 20,799
  • 66
  • 75
  • 101
idzi
  • 65
  • 7
  • Not sure what framework the code generated is. Check this answer http://stackoverflow.com/a/22983189/643500 it will generate a Spring MVC code that you can customize. – Sully Jan 27 '15 at 04:34

1 Answers1

1

In a JSP, you can use the following to see if they're logged in:

<c:if test="${empty pageContext.request.remoteUser}">
    not logged in
</c:if>
<c:if test="${not empty pageContext.request.remoteUser}">
    logged in
</c:if>
Matt Raible
  • 8,187
  • 9
  • 61
  • 120