Class SessionInfo

  • All Implemented Interfaces:
    java.io.Serializable

    public class SessionInfo
    extends java.lang.Object
    implements java.io.Serializable
    Session information valued with user rights during authentication
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SessionInfo​(int method, java.lang.String provider, java.lang.String login, java.lang.String token, boolean sync)
      Constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void createGroup​(java.lang.String name, java.lang.String moduleId)
      Create group
      static void createResponsibility​(ObjectDB resp, java.lang.String groupId, java.lang.String userId, java.lang.String moduleId)
      Create responsibility
      java.lang.String get​(java.lang.String attribute)
      Get user attribute
      java.lang.String get​(java.lang.String attribute, java.lang.String dflt)
      Get user attribute with default value
      java.util.Map<java.lang.String,​java.lang.String> getAttributes()
      Get other attributes
      java.util.List<java.lang.String> getGroups()
      Get granted groups
      java.lang.String getIDToken()
      Get ID token
      java.lang.String getLogin()
      Get user login
      int getMethod()
      Get authenticaton method
      java.lang.String getProvider()
      Get authentication provider name
      java.lang.String getRefreshToken()
      Get refresh token
      static java.lang.String getSyncModule()
      Get module to use in user and responsibilities synchronization
      java.lang.String getToken()
      Get token (access token)
      java.util.Map<java.lang.String,​java.lang.String> getUserDefaults()
      Get user default values per field during synchronization
      void put​(java.lang.String attribute, java.lang.String value)
      Set attribute value
      void setGroups​(java.util.List<java.lang.String> groups)
      Set granted groups
      void setIDToken​(java.lang.String idToken)
      Set ID token
      void setLogin​(java.lang.String login)
      Set user login
      void setProvider​(java.lang.String provider)
      Set auth provider name
      void setRefreshToken​(java.lang.String refreshToken)
      Set ID token
      void setToken​(java.lang.String token)
      Set token (access token)
      void setType​(int method)
      Set authenticaton method
      void syncUser​(java.lang.String login, java.lang.String moduleName)
      Synchronize session info with internal User/Resp when SYNC_USER=true
      static java.util.List<java.lang.String> syncUserGroups​(java.lang.String prop)
      List of groups to synchronize for property USER_SYNC_GROUPS_*
      org.json.JSONObject toJSONObject()
      To JSON object
      java.lang.String toString()
      To string
      boolean useSyncUser()
      Is user synchronization enabled?
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SessionInfo

        public SessionInfo​(int method,
                           java.lang.String provider,
                           java.lang.String login,
                           java.lang.String token,
                           boolean sync)
        Constructor
        Parameters:
        provider - Provider name
        method - Authentication method (one of AuthTool.AUTH_METHOD_*)
        login - Login
        token - Token
    • Method Detail

      • put

        public void put​(java.lang.String attribute,
                        java.lang.String value)
        Set attribute value
        Parameters:
        attribute - Attribute name
        value - Attribute value
      • get

        public java.lang.String get​(java.lang.String attribute)
        Get user attribute
        Parameters:
        attribute - Attribute name
        Returns:
        Attribute value or null if unknown
      • get

        public java.lang.String get​(java.lang.String attribute,
                                    java.lang.String dflt)
        Get user attribute with default value
        Parameters:
        attribute - Attribute name
        dflt - Default value if null
        Returns:
        Attribute value
      • getMethod

        public int getMethod()
        Get authenticaton method
        Returns:
        Authenticaton method (one of AuthTool.AUTH_METHOD_*)
      • setType

        public void setType​(int method)
        Set authenticaton method
        Parameters:
        method - Authenticaton method (one of AuthTool.AUTH_METHOD_*)
      • getProvider

        public java.lang.String getProvider()
        Get authentication provider name
        Returns:
        Authentication provider name
      • setProvider

        public void setProvider​(java.lang.String provider)
        Set auth provider name
        Parameters:
        provider - Authentication provider name
      • getToken

        public java.lang.String getToken()
        Get token (access token)
        Returns:
        Token
      • setToken

        public void setToken​(java.lang.String token)
        Set token (access token)
        Parameters:
        token - Token
      • getIDToken

        public java.lang.String getIDToken()
        Get ID token
        Returns:
        ID token
      • setIDToken

        public void setIDToken​(java.lang.String idToken)
        Set ID token
        Parameters:
        idToken - ID token
      • getRefreshToken

        public java.lang.String getRefreshToken()
        Get refresh token
        Returns:
        Refresh token
      • setRefreshToken

        public void setRefreshToken​(java.lang.String refreshToken)
        Set ID token
        Parameters:
        refreshToken - Refresh token
      • getLogin

        public java.lang.String getLogin()
        Get user login
        Returns:
        User login
      • setLogin

        public void setLogin​(java.lang.String login)
        Set user login
        Parameters:
        login - User login
      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.String> getAttributes()
        Get other attributes
        Returns:
        Other attributes
      • getGroups

        public java.util.List<java.lang.String> getGroups()
        Get granted groups
        Returns:
        Granted groups
      • setGroups

        public void setGroups​(java.util.List<java.lang.String> groups)
        Set granted groups
        Parameters:
        groups - Granted groups
      • useSyncUser

        public boolean useSyncUser()
        Is user synchronization enabled?
        Returns:
        True if USER_SYNC system parameter is set (not applicable to internal authentication provider)
      • getSyncModule

        public static java.lang.String getSyncModule()
        Get module to use in user and responsibilities synchronization
        Returns:
        Module name (defaults to default users and responsibilities module name)
      • getUserDefaults

        public java.util.Map<java.lang.String,​java.lang.String> getUserDefaults()
        Get user default values per field during synchronization
        Returns:
        Map of user default values
      • syncUserGroups

        public static java.util.List<java.lang.String> syncUserGroups​(java.lang.String prop)
        List of groups to synchronize for property USER_SYNC_GROUPS_*
      • syncUser

        public void syncUser​(java.lang.String login,
                             java.lang.String moduleName)
        Synchronize session info with internal User/Resp when SYNC_USER=true
        Parameters:
        login - Login of user
        moduleName - optional module name, default use system parameter USER_SYNC_MODULE
      • createResponsibility

        public static void createResponsibility​(ObjectDB resp,
                                                java.lang.String groupId,
                                                java.lang.String userId,
                                                java.lang.String moduleId)
        Create responsibility
        Parameters:
        resp - Responsibility object
        groupId - Group ID
        userId - user ID
        moduleId - module ID
      • createGroup

        public static void createGroup​(java.lang.String name,
                                       java.lang.String moduleId)
        Create group
        Parameters:
        name - Group name
        moduleId - Module ID
      • toJSONObject

        public org.json.JSONObject toJSONObject()
        To JSON object
      • toString

        public java.lang.String toString()
        To string
        Overrides:
        toString in class java.lang.Object