Package com.skava.oms.helper
Class AuthHelper
java.lang.Object
com.skava.oms.helper.AuthHelper
The class AuthHelper contains the validations made on the user
- Author:
- Infosys Equinox
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.skava.core.properties.AuthorizationProperties
to get auth configurations like guest user role nameprotected com.skava.core.auth.AuthTokenHandler
to get authTokenHandler servicecom.skava.core.auth.CustomSecurityConfigurer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.security.core.Authentication
getAuth()
final boolean
hasPrivilegeForBusinessById
(String privilege, Long businessId) hasPrivilegeForBusinessById.final boolean
hasPrivilegeForServiceAndCollection
(String privilegeName, String service, Long serviceCollectionId) Checks for privilege for service and collection.final boolean
hasRoleForBusinessByCollectionId
(String role, Long collectionId) hasRoleForBusiness.final boolean
hasRoleForBusinessById
(String role, Long businessId) hasRoleForBusinessById.final boolean
hasRoleForServiceAndCollection
(String roleName, String service, Long serviceCollectionId) Checks for role for service and collection.final boolean
isAdmin
(long collectionId) isSuperAdminfinal boolean
isBusinessAdmin
(Long businessId) isBusinessAdminfinal boolean
isSelfUser
(String userId) This method checks whether a user is a self user or notfinal boolean
-
Field Details
-
customSecurityConfigurer
@Autowired public com.skava.core.auth.CustomSecurityConfigurer customSecurityConfigurer -
authTokenHandler
@Autowired protected com.skava.core.auth.AuthTokenHandler authTokenHandlerto get authTokenHandler service -
authProps
@Autowired protected com.skava.core.properties.AuthorizationProperties authPropsto 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
isBusinessAdmin
.- Parameters:
businessId
- the business id- Returns:
- a
Boolean
object.
-
hasRoleForBusinessById
hasRoleForBusinessById.
This will return true only if the user has a privilege in authentication token given from the header else return false. -
hasRoleForBusinessByCollectionId
hasRoleForBusiness.
This will return true only if the user has a privilege in authentication token given from the header else return false. -
hasRoleForServiceAndCollection
public final boolean hasRoleForServiceAndCollection(String roleName, String service, Long serviceCollectionId) Checks for role for service and collection.- Parameters:
roleName
- the role nameservice
- the serviceserviceCollectionId
- 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 nameservice
- the serviceserviceCollectionId
- the service collection id- Returns:
- true, if successful
-
hasPrivilegeForBusinessById
hasPrivilegeForBusinessById.
This will return true only if the user's authentication has a privilege for the requested resource else return false. -
isUser
-
isSelfUser
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
-