Class AuthHelper

java.lang.Object
com.skava.oms.helper.AuthHelper

@Component public class AuthHelper extends Object
The class AuthHelper contains the validations made on the user
Author:
Infosys Equinox
  • Field Details

    • customSecurityConfigurer

      @Autowired public com.skava.core.auth.CustomSecurityConfigurer customSecurityConfigurer
    • authTokenHandler

      @Autowired protected com.skava.core.auth.AuthTokenHandler authTokenHandler
      to get authTokenHandler service
    • authProps

      @Autowired protected com.skava.core.properties.AuthorizationProperties authProps
      to get auth configurations like guest user role name
  • Constructor Details

    • AuthHelper

      protected AuthHelper()
  • Method Details

    • getAuth

      public static org.springframework.security.core.Authentication getAuth()
    • isAdmin

      public final boolean isAdmin(long collectionId)

      isSuperAdmin

      .
      Parameters:
      collectionId - contains the collectionId
      Returns:
      a Boolean object.
    • isBusinessAdmin

      public final boolean isBusinessAdmin(Long businessId)

      isBusinessAdmin

      .
      Parameters:
      businessId - the business id
      Returns:
      a Boolean object.
    • hasRoleForBusinessById

      public final boolean hasRoleForBusinessById(String role, Long businessId)

      hasRoleForBusinessById.

      This will return true only if the user has a privilege in authentication token given from the header else return false.
      Parameters:
      role - a String object. requested resource's role for business based authorization.
      businessId - a Long object. business identifier for business based authorization.
      Returns:
      Boolean object. authorization result(true means authorized. false means unauthorized.).
    • hasRoleForBusinessByCollectionId

      public final boolean hasRoleForBusinessByCollectionId(String role, Long collectionId)

      hasRoleForBusiness.

      This will return true only if the user has a privilege in authentication token given from the header else return false.
      Parameters:
      role - a String object. requested resource's role for business based authorization.
      collectionId - a String object. collection identifier for business based authorization.
      Returns:
      Boolean object. authorization result(true means authorized. false means unauthorized.).
    • hasRoleForServiceAndCollection

      public final boolean hasRoleForServiceAndCollection(String roleName, String service, Long serviceCollectionId)
      Checks for role for service and collection.
      Parameters:
      roleName - the role name
      service - the service
      serviceCollectionId - the service collection id
      Returns:
      true, if successful
    • hasPrivilegeForServiceAndCollection

      public final boolean hasPrivilegeForServiceAndCollection(String privilegeName, String service, Long serviceCollectionId)
      Checks for privilege for service and collection.
      Parameters:
      privilegeName - the privilege name
      service - the service
      serviceCollectionId - the service collection id
      Returns:
      true, if successful
    • hasPrivilegeForBusinessById

      public final boolean hasPrivilegeForBusinessById(String privilege, Long businessId)

      hasPrivilegeForBusinessById.

      This will return true only if the user's authentication has a privilege for the requested resource else return false.
      Parameters:
      privilege - a String object. requested resource's privilege for business based authorization.
      businessId - a Long object. Business identifier for business based authorization.
      Returns:
      Boolean object. authorization result(true means authorized. false means unauthorized.).
    • isUser

      public final boolean isUser(Long collectionId)
    • isSelfUser

      public final boolean isSelfUser(String userId)
      This method checks whether a user is a self user or not
      Parameters:
      userId - contains the user Id of the user who is going to be checked
      Returns:
      true if the user is self user
    • getAccessibleAccountIds

      public final Set<Long> getAccessibleAccountIds()