Announcement Announcement Module
Collapse
No announcement yet.
Spring EL and current user Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring EL and current user

    Is there a way to get the current logged in user using spring EL? I was looking at using authentiction implicit object

    I want something like this
    Code:
    	@Value("#authentication.name")
    	public void setCurrentUser(String currentUser)
    	{
    		this.currentUser = currentUser;
    	}
    The current logged in user should be assigned to the currentUser string variable.

  • #2
    No there is not. Note that if something like this were implemented the object would need to be bound to a request scope. If you are using something like Spring MVC, you can use the this thread. Struts2 has a similar thing with PrincipalAware. You can also take a look at Mike's presentation for tips on decoupling Spring Security and your application (i.e. write your own interface and implement it with SecurtiyContextHolder).

    Comment


    • #3
      Hi viveksrinivasan,

      Did you get to use currentUser as EL?

      Thanks
      Vinaya

      Comment

      Working...
      X