Class 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
    • Constructor Detail

      • IdAuthValidator

        public IdAuthValidator()
    • 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 id
        errors - the errors
      • validateIdvId

        public void validateIdvId​(String id,
                                  String idType,
                                  org.springframework.validation.Errors errors)
        Validate idv id.
        Parameters:
        id - the id
        idType - the id type
        errors - 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 id
        idType - the id type
        errors - the errors
        idFieldName - 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 ID
        errors - the errors
        paramName - the param name
      • validateReqTime

        protected void validateReqTime​(String reqTime,
                                       org.springframework.validation.Errors errors,
                                       String paramName)
        Validate req time.
        Parameters:
        reqTime - the req time
        errors - the errors
        paramName - 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 time
        errors - the errors
        paramName - the param name
        dateTimeParser - the date time parser
      • validateRequestTimedOut

        protected void validateRequestTimedOut​(String reqTime,
                                               org.springframework.validation.Errors errors)
        Validate request timed out.
        Parameters:
        reqTime - the req time
        errors - 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 time
        errors - the errors
        dateTimeParser - the date time parser
        paramName - 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 value
        errors - the errors
      • validateTxnId

        protected void validateTxnId​(String transactionID,
                                     String requestTransactionID,
                                     org.springframework.validation.Errors errors)
        Validate txn id.
        Parameters:
        transactionID - the transaction ID
        requestTransactionID - the request transaction ID
        errors - the errors
      • requestTimeParser

        protected Date requestTimeParser​(String reqTime)
                                  throws io.mosip.kernel.core.exception.ParseException
        Request time parser.
        Parameters:
        reqTime - the req time
        Returns:
        the date
        Throws:
        io.mosip.kernel.core.exception.ParseException - the parse exception