Class SessionUtil


public final class SessionUtil extends AuthGrandManipluationUtil
  • Constructor Details

    • SessionUtil

      protected SessionUtil()
  • Method Details

    • getAuthorityFromDB

      public static com.skava.core.auth.AuthGrantedAuthority getAuthorityFromDB(Long userId, Long collectionId, List<com.skava.core.auth.model.UserRoleData> ssoRoles, com.skava.core.auth.AuthTokenHandler authTokenHandler, UserRoleRepository userRoleRepository)
      Parameters:
      userId - a Long object.
      collectionId - a Long object.
      ssoRoles - a List of UserRoleData objects.
      authTokenHandler - a AuthTokenHandler object.
      userRoleRepository - a UserRoleRepository object.
      Returns:
      a AuthGrantedAuthority object.
    • isAuthTokenRequestValid

      public static boolean isAuthTokenRequestValid(Long userid, Long collectionId, String[] tokenData, com.skava.core.auth.AuthTokenHandler authTokenHandler)
    • createSession

      public static SessionVO createSession(Long userId, Long collectionId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, boolean isGuest, long tokenExpiryTime, AuthSessionHandler authSessionHandler, UserSessionRepository userSessionRepository)
      Parameters:
      userId - a Long object. identifier of the user which is used session creation.
      collectionId - a Long object. identifier of the collection which is used for session creation.
      authGrantedAuthority - a AuthGrantedAuthority object.
      isGuest - a Boolean object.
      tokenExpiryTime - a Long object.
      authSessionHandler - a AuthSessionHandler object.
      userSessionRepository - a UserSessionRepository object.
      Returns:
      a SessionVO object.
    • createRefreshToken

      public static String createRefreshToken(Long userId, Long actingUserId, Long collectionId, org.springframework.security.crypto.encrypt.TextEncryptor textEncryptor)
    • refreshSession

      public static SessionVO refreshSession(String sessionId, Long[] userIds, Long collectionId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, boolean isGuest, long tokenExpiryTime, AuthSessionHandler authSessionHandler)
      This method creates a new session with existing session identifier.
      Parameters:
      sessionId - a String object.
      userIds - a array of Long object.
      collectionId - a Long object. identifier of the collection which is used for session creation.
      authGrantedAuthority - a AuthGrantedAuthority object.
      tokenExpiryTime - a Long object.
      authSessionHandler - a AuthSessionHandler object.
      isGuest - isGuest
      Returns:
      a SessionVO object.
    • getUserSession

      public static UserSession getUserSession(String sessionId, UserSessionRepository userSessionRepository)
    • isGuest

      public static boolean isGuest(com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, AuthSessionHandler authSessionHandler)
    • createClientSession

      public static ClientSessionVO createClientSession(String clientId, Long collectionId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, boolean isGuest, long tokenExpiryTime, AuthSessionHandler authSessionHandler, ClientSessionRepository clientSessionRepository)
      Parameters:
      clientId - a String object. identifier of the user which is used session creation.
      collectionId - a Long object. identifier of the collection which is used for session creation.
      authGrantedAuthority - a AuthGrantedAuthority object.
      isGuest - a Boolean object.
      tokenExpiryTime - a Long object.
      authSessionHandler - a AuthSessionHandler object.
      clientSessionRepository - a ClientSessionRepository object.
      Returns:
      a SessionVO object.
    • getClientAuthorityFromDB

      public static com.skava.core.auth.AuthGrantedAuthority getClientAuthorityFromDB(String clientId, Long collectionId, List<com.skava.core.auth.model.UserRoleData> ssoRoles, com.skava.core.auth.AuthTokenHandler authTokenHandler, ClientRoleRepository clientRoleRepository)
      Parameters:
      clientId - a String object.
      collectionId - a Long object.
      ssoRoles - a List of UserRoleData objects.
      authTokenHandler - a AuthTokenHandler object.
      clientRoleRepository - a ClientRoleRepository object.
      Returns:
      a AuthGrantedAuthority object.
    • isClientAuthTokenRequestValid

      public static boolean isClientAuthTokenRequestValid(String clientid, Long collectionId, String[] tokenData, com.skava.core.auth.AuthTokenHandler authTokenHandler)
    • getClientSession

      public static ClientSession getClientSession(String sessionId, ClientSessionRepository clientSessionRepository)
    • createClientRefreshToken

      public static String createClientRefreshToken(String clientId, String actingClientId, Long collectionId, org.springframework.security.crypto.encrypt.TextEncryptor textEncryptor)
    • refreshClientSession

      public static SessionVO refreshClientSession(String sessionId, String[] clientIds, Long collectionId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, boolean isGuest, long tokenExpiryTime, AuthSessionHandler authSessionHandler)
      This method creates a new session with existing session identifier.
      Parameters:
      sessionId - a String object.
      clientIds - a array of String object.
      collectionId - a Long object. identifier of the collection which is used for session creation.
      authGrantedAuthority - a AuthGrantedAuthority object.
      tokenExpiryTime - a Long object.
      authSessionHandler - a AuthSessionHandler object.
      isGuest - isGuest
      Returns:
      a SessionVO object.
    • clearSession

      public static void clearSession(String sessionId, UserSession session, AuthCommonServices authCommonServices)
      clearSession
      Parameters:
      sessionId - holds String
      session - holds UserSession
    • clearOrchestrationCache

      public static void clearOrchestrationCache(List<UserSession> sessionList, org.springframework.data.redis.core.RedisTemplate<Object,Object> redisTemplate)
      This method will clear the adminorchestration cache in redis
      Parameters:
      sessionList - List of session to clear from redis cache
      redisTemplate - redis template
    • getPropertyValueByName

      public static String getPropertyValueByName(CollectionVO collection, String propertName)
      getPropertyValueByName
      Parameters:
      collection - holds CollectionVO
      propertName - holds String