Package com.almis.awe.model.component
Class AweSession
java.lang.Object
com.almis.awe.model.component.AweSession
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authentication
Retrieve session authentication<T> T
getParameter
(Class<T> clazz, String name) Returns parameter value cast to the given classgetParameter
(String name) Get parameterGet parameter names from current sessionGet current session idgetUser()
Get current session userboolean
hasAnyRole
(String... roleName) Check if current user has any of the given roleboolean
hasParameter
(String name) Check if there is a parameter in the sessionboolean
Check if current user has the given roleboolean
Check if current user has all the given roleboolean
Check if user is authenticatedvoid
removeParameter
(String name) Remove parameter from sessionvoid
setParameter
(String name, Object value) Set new parameter
-
Field Details
-
ROLE
- See Also:
-
-
Constructor Details
-
AweSession
public AweSession()Autowired constructor
-
-
Method Details
-
getAuthentication
public org.springframework.security.core.Authentication getAuthentication()Retrieve session authentication- Returns:
- Authentication
-
getSessionId
Get current session id- Returns:
- Session id
-
getUser
Get current session user- Returns:
- Session user
-
hasRole
Check if current user has the given role- Parameters:
roleName
- Role name- Returns:
- Has the role
-
hasRoles
Check if current user has all the given role- Parameters:
roleName
- Role names- Returns:
- Has all roles
-
hasAnyRole
Check if current user has any of the given role- Parameters:
roleName
- Role names- Returns:
- Has any of the roles
-
setParameter
Set new parameter- Parameters:
name
- Parameter namevalue
- Parameter value
-
getParameter
Get parameter- Parameters:
name
- Parameter name- Returns:
- Parameter value
-
getParameter
Returns parameter value cast to the given class- Type Parameters:
T
- class parameter type- Parameters:
clazz
- Parameter classname
- Parameter name- Returns:
- Parameter value
-
removeParameter
Remove parameter from session- Parameters:
name
- Parameter name
-
hasParameter
Check if there is a parameter in the session- Parameters:
name
- Parameter name- Returns:
- Session has parameter
-
getParameterNames
Get parameter names from current session- Returns:
- Parameter names
-
isAuthenticated
public boolean isAuthenticated()Check if user is authenticated- Returns:
- User is authenticated
-