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(quot;#authentication.namequot;)
public void setCurrentUser(String currentUser)
{
this.currentUser = currentUser;
}
The current logged in user should be assigned to the currentUser string variable.
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). |