Class IdAuthValidator
- java.lang.Object
-
- io.mosip.authentication.common.service.validator.IdAuthValidator
-
- All Implemented Interfaces:
org.springframework.validation.Validator
- Direct Known Subclasses:
BaseAuthRequestValidator,OTPRequestValidator
@Component public abstract class IdAuthValidator extends Object implements org.springframework.validation.Validator
The Class IdAuthValidator - abstract class containing common validations.- Author:
- Manoj SP
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringMISSING_INPUT_PARAMETERThe Constant MISSING_INPUT_PARAMETER.protected static StringVALIDATEThe Constant VALIDATE.
-
Constructor Summary
Constructors Constructor Description IdAuthValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetAllowedAuthTypeProperty()Gets the allowed auth type property.protected Set<String>getAllowedAuthTypes()Gets the allowed auth types.protected Set<String>getAllowedIdTypes()Gets the allowed id types.protected StringgetAllowedIdTypesConfigVal()Gets the allowed id types config key.protected DaterequestTimeParser(String reqTime)Request time parser.protected voidvalidateConsentReq(boolean consentValue, org.springframework.validation.Errors errors)Validates the ConsentRequest on request.voidvalidateId(String id, org.springframework.validation.Errors errors)Validate id - check whether id is null or not.voidvalidateIdvId(String id, String idType, org.springframework.validation.Errors errors)Validate idv id.voidvalidateIdvId(String id, String idType, org.springframework.validation.Errors errors, String idFieldName)Validate individual's id - check whether id is null or not and if valid, validates idType and UIN/VID.protected voidvalidateReqTime(String reqTime, org.springframework.validation.Errors errors, String paramName)Validate req time.protected voidvalidateReqTime(String reqTime, org.springframework.validation.Errors errors, String paramName, io.mosip.kernel.core.function.FunctionWithThrowable<Date,String,io.mosip.kernel.core.exception.ParseException> dateTimeParser)Validate req time.protected voidvalidateRequestTimedOut(String reqTime, org.springframework.validation.Errors errors)Validate request timed out.protected voidvalidateRequestTimedOut(String reqTime, org.springframework.validation.Errors errors, io.mosip.kernel.core.function.FunctionWithThrowable<Date,String,io.mosip.kernel.core.exception.ParseException> dateTimeParser, String paramName)Validate request timed out.protected voidvalidateTxnId(String transactionID, String requestTransactionID, org.springframework.validation.Errors errors)Validate txn id.protected voidvalidateTxnId(String txnID, org.springframework.validation.Errors errors, String paramName)Validate txn id - check whether it is of length 10 and alphanumeric.
-
-
-
Field Detail
-
MISSING_INPUT_PARAMETER
protected static final String MISSING_INPUT_PARAMETER
The Constant MISSING_INPUT_PARAMETER.- See Also:
- Constant Field Values
-
VALIDATE
protected static final String VALIDATE
The Constant VALIDATE.- See Also:
- Constant Field Values
-
-
Method Detail
-
validateId
public void validateId(String id, org.springframework.validation.Errors errors)
Validate id - check whether id is null or not.- Parameters:
id- the iderrors- the errors
-
validateIdvId
public void validateIdvId(String id, String idType, org.springframework.validation.Errors errors)
Validate idv id.- Parameters:
id- the ididType- the id typeerrors- the errors
-
validateIdvId
public void validateIdvId(String id, String idType, org.springframework.validation.Errors errors, String idFieldName)
Validate individual's id - check whether id is null or not and if valid, validates idType and UIN/VID.- Parameters:
id- the ididType- the id typeerrors- the errorsidFieldName- the id field name
-
validateTxnId
protected void validateTxnId(String txnID, org.springframework.validation.Errors errors, String paramName)
Validate txn id - check whether it is of length 10 and alphanumeric.- Parameters:
txnID- the txn IDerrors- the errorsparamName- the param name
-
validateReqTime
protected void validateReqTime(String reqTime, org.springframework.validation.Errors errors, String paramName)
Validate req time.- Parameters:
reqTime- the req timeerrors- the errorsparamName- the param name
-
validateReqTime
protected void validateReqTime(String reqTime, org.springframework.validation.Errors errors, String paramName, io.mosip.kernel.core.function.FunctionWithThrowable<Date,String,io.mosip.kernel.core.exception.ParseException> dateTimeParser)
Validate req time.- Parameters:
reqTime- the req timeerrors- the errorsparamName- the param namedateTimeParser- the date time parser
-
validateRequestTimedOut
protected void validateRequestTimedOut(String reqTime, org.springframework.validation.Errors errors)
Validate request timed out.- Parameters:
reqTime- the req timeerrors- the errors
-
validateRequestTimedOut
protected void validateRequestTimedOut(String reqTime, org.springframework.validation.Errors errors, io.mosip.kernel.core.function.FunctionWithThrowable<Date,String,io.mosip.kernel.core.exception.ParseException> dateTimeParser, String paramName)
Validate request timed out.- Parameters:
reqTime- the req timeerrors- the errorsdateTimeParser- the date time parserparamName- the param name
-
getAllowedIdTypes
protected Set<String> getAllowedIdTypes()
Gets the allowed id types.- Returns:
- the allowed id types
-
getAllowedAuthTypes
protected Set<String> getAllowedAuthTypes()
Gets the allowed auth types.- Returns:
- the allowed auth types
-
getAllowedAuthTypeProperty
protected String getAllowedAuthTypeProperty()
Gets the allowed auth type property.- Returns:
- the allowedAuthType
-
getAllowedIdTypesConfigVal
protected String getAllowedIdTypesConfigVal()
Gets the allowed id types config key.- Returns:
- the allowed id types config key
-
validateConsentReq
protected void validateConsentReq(boolean consentValue, org.springframework.validation.Errors errors)Validates the ConsentRequest on request.- Parameters:
consentValue- the consent valueerrors- the errors
-
validateTxnId
protected void validateTxnId(String transactionID, String requestTransactionID, org.springframework.validation.Errors errors)
Validate txn id.- Parameters:
transactionID- the transaction IDrequestTransactionID- the request transaction IDerrors- the errors
-
-