Interface CredentialAccessor

  • All Superinterfaces:
    ICredentials

    public interface CredentialAccessor
    extends ICredentials
    Interface used to retrieve information about a credential for a specific usage. All data retrieved through this interface is related to the logged user and the current channel.
    • Method Detail

      • addRequiredValidation

        void addRequiredValidation​(Validator validator,
                                   Property<?,​?> property)
        Adds a required property validation for the given property ONLY if credentials are used.
        If the property is null then the validations are added as general ones.
      • canActivateCredentials

        boolean canActivateCredentials()
        Indicates whether the authenticated user can activate any of the allowed credentials
      • canBeUsed

        boolean canBeUsed()
        Returns true if at least one of the defined credentials can be used, i.e: if passwords can be used and its status is one of these: PasswordStatus.ACTIVE, PasswordStatus.EXPIRED,PasswordStatus.RESET or if devices can be used and the user has at least one trusted device.
        If no credentials are defined for the current usage then it returns false.
      • getActiveCredentials

        List<CredentialType> getActiveCredentials()
        Returns the credential types that are active for the user
      • getCredentialInput

        CredentialInputDTO getCredentialInput()
        Returns information for a credential input
      • getOtpSendMediums

        List<SendMedium> getOtpSendMediums()
        Returns the allowed mediums an OTP can be send to the logged user according to the credential usage.
      • hasExpired

        boolean hasExpired()
        Returns true if the allowed credentials has expired, i.e: if passwords can be used but is expired (the status is one of these: PasswordStatus.EXPIRED, PasswordStatus.RESET) or if devices can be used but the user doesn't have any trusted device.
        If no credentials are defined for the current usage then it returns false.
      • requestNewOTP

        List<String> requestNewOTP​(@NotNull
                                   @NotNull SendMedium medium,
                                   List<Long> mobilePhoneIds)
                            throws SmsSendingException,
                                   MailSendException
        Generates a new OTP (removing any previous password, if any) and sends it by the specified medium (to the given mobile phones if any, in case of SendMedium.SMS) using the password type for the current usage, current channel and the logged user.
        Parameters:
        medium - the medium used to send the OTP.
        mobilePhoneIds - the identifiers of mobile phones to send the OTP if the medium is SendMedium.SMS.
        Returns:
        the email or the normalized phone numbers the OTP was sent.
        Throws:
        SmsSendingException - only if medium is SendMedium.SMS and the OTP could not be sent to any enabled for sms phone.
        MailSendException - only if medium is SendMedium.EMAIL and the OTP could not be sent.