Class UtilBase

Direct Known Subclasses:
AuthGrandManipluationUtil

public class UtilBase extends JavaCollectionUtil
This class holds the frequently used utility methods.
Author:
Infosys Equinox
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static com.skava.core.auth.AuthenticationToken
    THis method returns the authentication from security context.
    protected static com.skava.core.auth.AuthenticationToken
    getAuthenticationToken(Long userId, Long actingUserId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority)
    This method returns the authentication based on userid, aciting userid and grant of the user.
    protected static <T> T
    getBean(org.springframework.context.ApplicationContext context, String className, Class<T> type)
    This method returns the bean reference based on the given class type.
    protected static com.skava.core.auth.AuthenticationToken
    getClientAuthenticationToken(String clientId, String actingClientId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority)
    This method returns the authentication based on clientId, aciting clientId and grant of the client.
    static com.skava.core.auth.AuthenticationToken
    getClientAuthenticationTokenBase(String clientId, String actingClientId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority)
    getClientAuthenticationToken.
    protected static long
    THis method return the current TImeStamp.
    protected static com.skava.core.errorhandler.ResourceNotFoundException
    resourceNotFoundException(String resourceName, String fieldName, String fieldValue)
    This method returns the resource not found exception.
    static void
    validateClientId(String clientId, org.springframework.context.MessageSource messageSource)
    THis method validates the user identifier.
    static void
    validateCollectionId(Long collectionId, org.springframework.context.MessageSource messageSource)
    THis method validates the collection identifier.
    static void
    validateUserId(Long userId, org.springframework.context.MessageSource messageSource)
    THis method validates the user identifier.
    protected static com.skava.core.validation.ValidateException
    validationException(org.springframework.context.MessageSource messageSource, AuthResponseCodes responseCode)
    This method returns the validation exception based on the response code.

    Methods inherited from class com.skava.auth.util.JavaCollectionUtil

    convertToList, getNewList, getNewSet, hasSingleKey

    Methods inherited from class java.lang.Object

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

    • UtilBase

      protected UtilBase()
      default constructor.
  • Method Details

    • getAuthentication

      protected static com.skava.core.auth.AuthenticationToken getAuthentication()
      THis method returns the authentication from security context.
      Returns:
      a AuthenticationToken object.
    • getAuthenticationToken

      protected static com.skava.core.auth.AuthenticationToken getAuthenticationToken(Long userId, Long actingUserId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority)
      This method returns the authentication based on userid, aciting userid and grant of the user.
      Parameters:
      userId - a Long object.
      actingUserId - a Long object.
      authGrantedAuthority - a AuthGrantedAuthority object.
      Returns:
      a AuthenticationToken object.
    • resourceNotFoundException

      protected static com.skava.core.errorhandler.ResourceNotFoundException resourceNotFoundException(String resourceName, String fieldName, String fieldValue)
      This method returns the resource not found exception.
      Parameters:
      resourceName - a String object.
      fieldName - a String object.
      fieldValue - a String object.
      Returns:
      a ResourceNotFoundException object.
    • validationException

      protected static com.skava.core.validation.ValidateException validationException(org.springframework.context.MessageSource messageSource, AuthResponseCodes responseCode)
      This method returns the validation exception based on the response code.
      Parameters:
      messageSource - a MessageSource object.
      responseCode - a AuthResponseCodes object.
      Returns:
      a ValidateException object.
    • getCurrentTimeInMillis

      protected static long getCurrentTimeInMillis()
      THis method return the current TImeStamp.
      Returns:
      a Long object.
    • validateCollectionId

      public static void validateCollectionId(Long collectionId, org.springframework.context.MessageSource messageSource)
      THis method validates the collection identifier.
      Parameters:
      collectionId - a Long object.
      messageSource - a MessageSource object.
    • validateUserId

      public static void validateUserId(Long userId, org.springframework.context.MessageSource messageSource)
      THis method validates the user identifier.
      Parameters:
      userId - a Long object.
      messageSource - a MessageSource object.
    • getBean

      protected static <T> T getBean(org.springframework.context.ApplicationContext context, String className, Class<T> type)
      This method returns the bean reference based on the given class type.
      Type Parameters:
      T - type of the bean
      Parameters:
      context - a ApplicationContext object.
      className - a String object.
      type - a Class object.
      Returns:
      a requested bean.
    • getClientAuthenticationToken

      protected static com.skava.core.auth.AuthenticationToken getClientAuthenticationToken(String clientId, String actingClientId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority)
      This method returns the authentication based on clientId, aciting clientId and grant of the client.
      Parameters:
      clientId - a String object.
      actingClientId - a String object.
      authGrantedAuthority - a AuthGrantedAuthority object.
      Returns:
      a AuthenticationToken object.
    • getClientAuthenticationTokenBase

      public static com.skava.core.auth.AuthenticationToken getClientAuthenticationTokenBase(String clientId, String actingClientId, com.skava.core.auth.AuthGrantedAuthority authGrantedAuthority)

      getClientAuthenticationToken.

      Parameters:
      clientId - a String object.
      actingClientId - a String object.
      authGrantedAuthority - a AuthGrantedAuthority object.
      Returns:
      a AuthenticationToken object.
      Since:
      8.0.1
    • validateClientId

      public static void validateClientId(String clientId, org.springframework.context.MessageSource messageSource)
      THis method validates the user identifier.
      Parameters:
      clientId - a String object.
      messageSource - a MessageSource object.