Package com.skava.auth.util
Class SessionUtil
java.lang.Object
com.skava.auth.util.JavaCollectionUtil
com.skava.auth.util.UtilBase
com.skava.auth.util.AuthGrandManipluationUtil
com.skava.auth.util.SessionUtil
-
Field Summary
Fields inherited from class com.skava.auth.util.AuthGrandManipluationUtil
CUSTOM_ROLE_TYPE, DEFAULT_ACCOUNT_ID, DEFAULT_ROLE_SERVICE, DEFAULT_ROLE_TYPE, SSO_AUTHORIZATION_DATA_INDEX, SSO_BEARER_TOKEN_SIZE, SSO_TYPE_INDEX
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clearOrchestrationCache
(List<UserSession> sessionList, org.springframework.data.redis.core.RedisTemplate<Object, Object> redisTemplate) This method will clear the adminorchestration cache in redisstatic void
clearSession
(String sessionId, UserSession session, AuthCommonServices authCommonServices) clearSessionstatic String
createClientRefreshToken
(String clientId, String actingClientId, Long collectionId, org.springframework.security.crypto.encrypt.TextEncryptor textEncryptor) static ClientSessionVO
createClientSession
(String clientId, Long collectionId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, boolean isGuest, long tokenExpiryTime, AuthSessionHandler authSessionHandler, ClientSessionRepository clientSessionRepository) static String
createRefreshToken
(Long userId, Long actingUserId, Long collectionId, org.springframework.security.crypto.encrypt.TextEncryptor textEncryptor) static SessionVO
createSession
(Long userId, Long collectionId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, boolean isGuest, long tokenExpiryTime, AuthSessionHandler authSessionHandler, UserSessionRepository userSessionRepository) 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) 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) static ClientSession
getClientSession
(String sessionId, ClientSessionRepository clientSessionRepository) static String
getPropertyValueByName
(CollectionVO collection, String propertName) getPropertyValueByNamestatic UserSession
getUserSession
(String sessionId, UserSessionRepository userSessionRepository) static boolean
isAuthTokenRequestValid
(Long userid, Long collectionId, String[] tokenData, com.skava.core.auth.AuthTokenHandler authTokenHandler) static boolean
isClientAuthTokenRequestValid
(String clientid, Long collectionId, String[] tokenData, com.skava.core.auth.AuthTokenHandler authTokenHandler) static boolean
isGuest
(com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, AuthSessionHandler authSessionHandler) 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.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.Methods inherited from class com.skava.auth.util.AuthGrandManipluationUtil
getAuthorityFromCache, getAuthorityGrant, getClientAuthorityFromCache, getClientAuthorityGrant, getGranterRolesFromRolePrivilegeMapper, getSSOGrantedRoles, getSSORoles, getTokenExpiryTime
Methods inherited from class com.skava.auth.util.UtilBase
getAuthentication, getAuthenticationToken, getBean, getClientAuthenticationToken, getClientAuthenticationTokenBase, getCurrentTimeInMillis, resourceNotFoundException, validateClientId, validateCollectionId, validateUserId, validationException
Methods inherited from class com.skava.auth.util.JavaCollectionUtil
convertToList, getNewList, getNewSet, hasSingleKey
-
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
- aLong
object.collectionId
- aLong
object.ssoRoles
- aList
ofUserRoleData
objects.authTokenHandler
- aAuthTokenHandler
object.userRoleRepository
- aUserRoleRepository
object.- Returns:
- a
AuthGrantedAuthority
object.
-
isAuthTokenRequestValid
-
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
- aLong
object. identifier of the user which is used session creation.collectionId
- aLong
object. identifier of the collection which is used for session creation.authGrantedAuthority
- aAuthGrantedAuthority
object.isGuest
- aBoolean
object.tokenExpiryTime
- aLong
object.authSessionHandler
- aAuthSessionHandler
object.userSessionRepository
- aUserSessionRepository
object.- Returns:
- a
SessionVO
object.
-
createRefreshToken
-
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
- aString
object.userIds
- a array ofLong
object.collectionId
- aLong
object. identifier of the collection which is used for session creation.authGrantedAuthority
- aAuthGrantedAuthority
object.tokenExpiryTime
- aLong
object.authSessionHandler
- aAuthSessionHandler
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
- aString
object. identifier of the user which is used session creation.collectionId
- aLong
object. identifier of the collection which is used for session creation.authGrantedAuthority
- aAuthGrantedAuthority
object.isGuest
- aBoolean
object.tokenExpiryTime
- aLong
object.authSessionHandler
- aAuthSessionHandler
object.clientSessionRepository
- aClientSessionRepository
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
- aString
object.collectionId
- aLong
object.ssoRoles
- aList
ofUserRoleData
objects.authTokenHandler
- aAuthTokenHandler
object.clientRoleRepository
- aClientRoleRepository
object.- Returns:
- a
AuthGrantedAuthority
object.
-
isClientAuthTokenRequestValid
-
getClientSession
public static ClientSession getClientSession(String sessionId, ClientSessionRepository clientSessionRepository) -
createClientRefreshToken
-
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
- aString
object.clientIds
- a array ofString
object.collectionId
- aLong
object. identifier of the collection which is used for session creation.authGrantedAuthority
- aAuthGrantedAuthority
object.tokenExpiryTime
- aLong
object.authSessionHandler
- aAuthSessionHandler
object.isGuest
- isGuest- Returns:
- a
SessionVO
object.
-
clearSession
public static void clearSession(String sessionId, UserSession session, AuthCommonServices authCommonServices) clearSession- Parameters:
sessionId
- holds Stringsession
- 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 cacheredisTemplate
- redis template
-
getPropertyValueByName
getPropertyValueByName- Parameters:
collection
- holds CollectionVOpropertName
- holds String
-