Class AuthSessionHandler

java.lang.Object
com.skava.auth.helper.AuthSessionHandler

@Component public class AuthSessionHandler extends Object
This class used to handle the user session operations like put token to the cache, get token from the cache, remove the session, etc.
Version:
$Id: $Id
Author:
Infosys Equinox
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor of the class.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.core.Authentication
    This method return the authorization token from cache by using identifier of the session.
    This method return the currently logged in client.
    This method return the currently logged in user.
    void
    putToken(String sessionId, String refreshToken, com.skava.core.auth.AuthenticationToken authToken, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, boolean isGuest, Long authExpiryTime)
    This method put the session details of the user to session cache.
    void
    removeSession(String sessionId)
    This method remove the session details of the user from session cache by session identifier.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AuthSessionHandler

      public AuthSessionHandler()
      Default constructor of the class.
  • Method Details

    • getAuthentication

      public org.springframework.security.core.Authentication getAuthentication(String sessionid)
      This method return the authorization token from cache by using identifier of the session.
      Parameters:
      sessionid - a String object. a identifier of the session given to user after establishing the session with system.
      Returns:
      a Authentication object. a authorized token alloted for the given session id with session id from the cache.
    • getLoggedInUserId

      public Long getLoggedInUserId()
      This method return the currently logged in user.
      Returns:
      a Long object. a identifier of the user from the authorization token.
    • getLoggedInClientId

      public String getLoggedInClientId()
      This method return the currently logged in client.
      Returns:
      a String object. a identifier of the client from the authorization token.
    • putToken

      public void putToken(String sessionId, String refreshToken, com.skava.core.auth.AuthenticationToken authToken, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority, boolean isGuest, Long authExpiryTime)
      This method put the session details of the user to session cache.
      Parameters:
      refreshToken - refreshToken
      sessionId - sessionId
      authToken - a AuthenticationToken object. an alloted token to the session with session id for caching.
      authGrantedAuthority - a AuthGrantedAuthority object.
      isGuest - a boolean value denoting whether the session is for guest user or not.
      authExpiryTime - a Long object. an expire time of authorization token.
    • removeSession

      public void removeSession(String sessionId)
      This method remove the session details of the user from session cache by session identifier.
      Parameters:
      sessionId - to remove a session from cache