public class SecurityUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ANONYMOUS_USERNAME |
static String |
AUTHORITY_ANONYMOUS |
static String |
AUTHORITY_ENTITY_COUNT_PREFIX |
static String |
AUTHORITY_ENTITY_PREFIX |
static String |
AUTHORITY_ENTITY_READ_PREFIX |
static String |
AUTHORITY_ENTITY_WRITE_PREFIX |
static String |
AUTHORITY_ENTITY_WRITEMETA_PREFIX |
static String |
AUTHORITY_PLUGIN_COUNT_PREFIX |
static String |
AUTHORITY_PLUGIN_PREFIX |
static String |
AUTHORITY_PLUGIN_READ_PREFIX |
static String |
AUTHORITY_PLUGIN_WRITE_PREFIX |
static String |
AUTHORITY_PLUGIN_WRITEMETA_PREFIX |
static String |
AUTHORITY_SU |
| Constructor and Description |
|---|
SecurityUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
currentUserHasRole(String... roles)
Returns whether the current user has at least one of the given roles
|
static boolean |
currentUserIsAuthenticated()
Returns whether the current user is authenticated and not the anonymous user
|
static boolean |
currentUserIsSu()
Returns whether the current user is a super user
|
static boolean |
currentUserIsSuOrSystem()
Returns whether the current user is a superuser or the system user.
|
static boolean |
currentUserisSystem()
Returns whether the current user is the system user.
|
static String[] |
defaultPluginAuthorities(String... pluginIds)
Returns the default (su, read, write) roles related to a plugin
|
static String |
getCurrentUsername() |
static List<String> |
getEntityAuthorities(String entityName)
Get all possible authorities (roles) for an entity
|
static String |
getPluginReadAuthority(String pluginId) |
static String |
getPluginWriteAuthority(String pluginId) |
static String |
getUsername(org.springframework.security.core.Authentication authentication) |
static boolean |
isSessionExpired(javax.servlet.http.HttpServletRequest request)
Checks if client session is expired (by checking the requested sessionId).
|
public static final String ANONYMOUS_USERNAME
public static final String AUTHORITY_SU
public static final String AUTHORITY_ANONYMOUS
public static final String AUTHORITY_PLUGIN_PREFIX
public static final String AUTHORITY_PLUGIN_READ_PREFIX
public static final String AUTHORITY_PLUGIN_WRITE_PREFIX
public static final String AUTHORITY_PLUGIN_COUNT_PREFIX
public static final String AUTHORITY_PLUGIN_WRITEMETA_PREFIX
public static final String AUTHORITY_ENTITY_PREFIX
public static final String AUTHORITY_ENTITY_READ_PREFIX
public static final String AUTHORITY_ENTITY_WRITE_PREFIX
public static final String AUTHORITY_ENTITY_COUNT_PREFIX
public static final String AUTHORITY_ENTITY_WRITEMETA_PREFIX
public static String getCurrentUsername()
public static String getUsername(org.springframework.security.core.Authentication authentication)
public static boolean currentUserHasRole(String... roles)
roles - public static boolean currentUserIsSuOrSystem()
public static boolean currentUserIsSu()
public static boolean currentUserisSystem()
public static boolean currentUserIsAuthenticated()
public static String[] defaultPluginAuthorities(String... pluginIds)
pluginIds - public static List<String> getEntityAuthorities(String entityName)
entityName - public static boolean isSessionExpired(javax.servlet.http.HttpServletRequest request)
request - Copyright © 2017. All Rights Reserved.