Package com.skava.auth.util
Class AuthUtil
java.lang.Object
com.skava.auth.util.AuthUtil
This is a Utility class for Authorization model which contains validator and helper methods used in this service.
- Author:
- Infosys Equinox
-
Method Summary
Modifier and TypeMethodDescriptionstatic String[]
decryptBearerToken
(org.springframework.security.crypto.encrypt.TextEncryptor textEncryptor, String token) static Set<CollectionProperty>
getCollectionProperties
(Collection collection, List<CollectionPropertyVO> requestProperties, List<CollectionAttribute> attributes, org.springframework.context.MessageSource messageSource) static CollectionStatus
getCollectionStatus
(CollectionVO request) validateCollectionStatusstatic long
This method will return the current milliseconds using Calendar object.static Matcher
getMatcherOfFilter
(String patternStr, String patternSplitStr, String filter) This method will Creates a matcher that will match the given input against given pattern.getPossibleValues
(CollectionAttribute attribute) static String
getPropertyValue
(CollectionAttribute attribute, CollectionPropertyVO requestProperty) static Set<CollectionProperty>
getUpdatedCollectionProperties
(Collection collection, List<CollectionPropertyVO> requestProperties, List<CollectionAttribute> attributes, org.springframework.context.MessageSource messageSource) static Long
getUserId.static boolean
hasSelfAccess
(Long collectionId, Matcher valuesMatcher, int userCount, com.skava.core.auth.AuthTokenHandler authTokenHandler) static boolean
hasSelfClientAccess
(Long collectionId, Matcher valuesMatcher, int clientCount, com.skava.core.auth.AuthTokenHandler authTokenHandler) static boolean
isBearerTokenValid
(String[] tokenData, Long userId) This method used to validate the bearer token based on the given user information.static boolean
isBusinessIdValid
(Long businessId) isValidBusinessIdstatic boolean
isClientBearerTokenValid
(String[] tokenData, String clientId) This method used to validate the bearer token based on the given client information.static boolean
isClientIdValid
(String clientId) static boolean
isCollectionNameValid
(String collectionName) static boolean
isCollectionPropertyAndAttributeEquals
(CollectionAttribute attribute, CollectionPropertyVO property) static boolean
static boolean
isDescriptionValid
(String description) static boolean
isInstanceLevelBusinessId
(Long businessId) iInstanceLevelBusinessIdstatic boolean
isObjectValid
(Object input) static boolean
isPossibleValuesAvailable
(CollectionAttributeType attributeType) static boolean
isRoleNameValid
(String roleName) static boolean
isUserIdValid
(Long userId) static boolean
isValidCollectionId
(Long collectionId) This method is used to validate the collection identifier.static boolean
isValidLong
(Long input) static boolean
isValidString
(String input)
-
Method Details
-
getUserId
getUserId.
This will return authentication principle(userid)- Returns:
- a
Long
object. Identifier of the user by parsing the authorization token.
-
isValidString
-
isValidLong
-
isObjectValid
-
getMatcherOfFilter
This method will Creates a matcher that will match the given input against given pattern. -
isValidCollectionId
This method is used to validate the collection identifier. -
isBusinessIdValid
isValidBusinessId
This method is used to validate the collection identifier. -
isInstanceLevelBusinessId
iInstanceLevelBusinessId
This method is used to validate the collection identifier. -
getCollectionStatus
validateCollectionStatus
- Parameters:
request
- aCollectionVO
object.- Returns:
- a
CollectionStatus
object.
-
isCollectionNameValid
-
isDescriptionValid
-
getCollectionProperties
public static Set<CollectionProperty> getCollectionProperties(Collection collection, List<CollectionPropertyVO> requestProperties, List<CollectionAttribute> attributes, org.springframework.context.MessageSource messageSource) - Parameters:
collection
- aCollection
object.requestProperties
- aList
ofCollectionPropertyVO
objects.attributes
- aList
ofCollectionAttribute
objects.messageSource
- aMessageSource
object.- Returns:
- a
Set
ofCollectionProperty
objects.
-
getUpdatedCollectionProperties
public static Set<CollectionProperty> getUpdatedCollectionProperties(Collection collection, List<CollectionPropertyVO> requestProperties, List<CollectionAttribute> attributes, org.springframework.context.MessageSource messageSource) - Parameters:
collection
- aCollection
object.requestProperties
- aList
ofCollectionPropertyVO
objects.attributes
- aList
ofCollectionAttribute
objects.messageSource
- aMessageSource
object.- Returns:
- a
Set
ofCollectionProperty
objects.
-
getPropertyValue
public static String getPropertyValue(CollectionAttribute attribute, CollectionPropertyVO requestProperty) - Parameters:
attribute
- aCollectionAttribute
object.requestProperty
- aCollectionPropertyVO
object.- Returns:
- a
String
object.
-
isCollectionPropertyAndAttributeEquals
public static boolean isCollectionPropertyAndAttributeEquals(CollectionAttribute attribute, CollectionPropertyVO property) - Parameters:
attribute
- aCollectionAttribute
object.property
- aCollectionPropertyVO
object.- Returns:
- a
Boolean
object.
-
isCollectionPropertyHaveValidValue
- Parameters:
property
- aCollectionPropertyVO
object.- Returns:
- a
Boolean
object.
-
isBearerTokenValid
This method used to validate the bearer token based on the given user information. -
decryptBearerToken
-
getPossibleValues
- Parameters:
attribute
- aCollectionAttribute
object.- Returns:
- a
List
ofString
objects.
-
isPossibleValuesAvailable
- Parameters:
attributeType
- aCollectionAttributeType
object.- Returns:
- a
Boolean
object.
-
isUserIdValid
-
isClientIdValid
-
isRoleNameValid
-
hasSelfAccess
-
hasSelfClientAccess
-
getCurrentMilliseconds
public static long getCurrentMilliseconds()This method will return the current milliseconds using Calendar object.- Returns:
- long time in milliseconds
-
isClientBearerTokenValid
This method used to validate the bearer token based on the given client information.
-