Class AweSession

    • Constructor Detail

      • AweSession

        public AweSession()
        Autowired constructor
    • Method Detail

      • getAuthentication

        public org.springframework.security.core.Authentication getAuthentication()
        Retrieve session authentication
        Returns:
        Authentication
      • getSessionId

        public String getSessionId()
        Get current session id
        Returns:
        Session id
      • getUser

        public String getUser()
        Get current session user
        Returns:
        Session user
      • hasRole

        public boolean hasRole​(String roleName)
        Check if current user has the given role
        Parameters:
        roleName - Role name
        Returns:
        Has the role
      • hasRoles

        public boolean hasRoles​(String... roleName)
        Check if current user has all the given role
        Parameters:
        roleName - Role names
        Returns:
        Has all roles
      • hasAnyRole

        public boolean hasAnyRole​(String... roleName)
        Check if current user has any of the given role
        Parameters:
        roleName - Role names
        Returns:
        Has any of the roles
      • setParameter

        public void setParameter​(String name,
                                 Object value)
        Set new parameter
        Parameters:
        name - Parameter name
        value - Parameter value
      • getParameter

        public Object getParameter​(String name)
        Get parameter
        Parameters:
        name - Parameter name
        Returns:
        Parameter value
      • getParameter

        public <T> T getParameter​(Class<T> clazz,
                                  String name)
        Returns parameter value casted to the given class
        Type Parameters:
        T - class parameter type
        Parameters:
        clazz - Parameter class
        name - Parameter name
        Returns:
        Parameter value
      • removeParameter

        public void removeParameter​(String name)
        Remove parameter from session
        Parameters:
        name - Parameter name
      • hasParameter

        public boolean hasParameter​(String name)
        Check if there is a parameter in the session
        Parameters:
        name - Parameter name
        Returns:
        Session has parameter
      • getParameterNames

        public Set<String> getParameterNames()
        Get parameter names from current session
        Returns:
        Parameter names
      • isAuthenticated

        public boolean isAuthenticated()
        Check if user is authenticated
        Returns:
        User is authenticated