public class PrincipalUtils extends Object
Constructor and Description |
---|
PrincipalUtils() |
Modifier and Type | Method and Description |
---|---|
static org.springframework.security.core.Authentication |
createAuthentication(String user,
Set<String> roles)
Create authentication token
|
static org.springframework.security.core.Authentication |
getAuthentication()
Obtain authentication token
|
static org.springframework.security.core.Authentication |
getAuthenticationByToken(String token)
Get Authentication by token and also set it as current Authentication.
|
static Set<String> |
getRoles()
Obtain the list of user roles.
|
static String |
getUser()
Obtain the logged user.
|
static boolean |
hasRole(String role)
Check for role
|
static void |
setAuthentication(org.springframework.security.core.Authentication auth)
Set authentication token
|
public static String getUser()
public static boolean hasRole(String role)
public static org.springframework.security.core.Authentication getAuthenticationByToken(String token) throws AccessDeniedException
AccessDeniedException
public static org.springframework.security.core.Authentication getAuthentication()
public static void setAuthentication(org.springframework.security.core.Authentication auth)
Copyright © 2017 Open Knowledge Management System S.L.. All rights reserved.