Class ValueTypeValidator
java.lang.Object
io.getlime.security.powerauth.http.validator.ValueTypeValidator
Utility class to validate various value types, such as UUID, base64 encoded data, etc.
- Author:
- Petr Dvorak, petr@wultra.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisDecimalString(String decimalString, int from, int to) Check if the string is a decimal string of provided length range.static booleanisValidBase64OfLength(String base64candidate, int expectedLength) Validate provided string that is expected to be in Base64 encoding.static booleanisValidBase64OfLengthRange(String base64candidate, int from, int to) Validate provided string that is expected to be in Base64 encoding.static booleanisValidProtocolVersion(String version) Check if the provided version is a valid one.static booleanisValidSignatureType(String signatureType) Check if the provided signature type value is valid.static booleanisValidSignatureValue(String signature) Validate if the provided signature is of a correct format.static booleanisValidUuid(String uuidCandidate) Check if provided string is a valid UUID.
-
Constructor Details
-
ValueTypeValidator
public ValueTypeValidator()
-
-
Method Details
-
isValidUuid
Check if provided string is a valid UUID.- Parameters:
uuidCandidate- UUID candidate.- Returns:
- True in case provided string is a valid UUID, false otherwise.
-
isValidBase64OfLength
Validate provided string that is expected to be in Base64 encoding. If the string is in Base64 encoding, validate for expected length of decoded bytes.- Parameters:
base64candidate- Base64 string candidate.expectedLength- Expected length od decoded bytes.- Returns:
- True in case the provided string are Base64 encoded data of expected byte length, false otherwise.
-
isValidBase64OfLengthRange
Validate provided string that is expected to be in Base64 encoding. If the string is in Base64 encoding, validate if expected length of decoded bytes is in range from-to.- Parameters:
base64candidate- Base64 string candidate.from- Expected minimal length od decoded bytes.to- Expected maximal length od decoded bytes.- Returns:
- True in case the provided string are Base64 encoded data of expected byte length, false otherwise.
-
isValidSignatureType
Check if the provided signature type value is valid.- Parameters:
signatureType- Signature type candidate.- Returns:
- True if the provided signature type is valid.
-
isValidSignatureValue
Validate if the provided signature is of a correct format.- Parameters:
signature- Signature candidate.- Returns:
- True if signature candidate has correct format, false otherwise.
-
isDecimalString
Check if the string is a decimal string of provided length range.- Parameters:
decimalString- Decimal string candidate.from- Minimal length.to- Maximal length.- Returns:
- True if provided string is decimal and has expected length range.
-
isValidProtocolVersion
Check if the provided version is a valid one.- Parameters:
version- Version to check.- Returns:
- True if provided version is valid, false otherwise.
-