org.squashtest.tm.service.security
Class SpringSecurityUserContextService
java.lang.Object
org.squashtest.tm.service.security.SpringSecurityUserContextService
- All Implemented Interfaces:
- UserContextService
@Component(value="squashtest.core.user.UserContextService")
public class SpringSecurityUserContextService
- extends Object
- implements UserContextService
A UserContextService backed by Spring Security.
- Author:
- Gregory Fouquet
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SpringSecurityUserContextService
public SpringSecurityUserContextService()
getUsername
public String getUsername()
- Specified by:
getUsername in interface UserContextService
- Returns:
- the username of the current user. If no user is authenticated, returns an empty string.
hasRole
public boolean hasRole(String role)
- Specified by:
hasRole in interface UserContextService
- Returns:
- true if the current user has the given role.
getPrincipal
public org.springframework.security.core.Authentication getPrincipal()
- Specified by:
getPrincipal in interface UserContextService
- Returns:
- the current user authentication object or
null if no user authenticated.
Copyright © 2010-2013 Henix, henix.fr. All Rights Reserved.