code: @Override
      protected boolean authenticateUsernamePasswordInternal(final UsernamePasswordCredentials usernamePasswordCredentials) throws AuthenticationException {
          try {
              final String uid = usernamePasswordCredentials.getUsername();
              final String otp = usernamePasswordCredentials.getPassword();
  
              if (YubicoClient.isValidOTPFormat(otp)) {
  
                  final String publicId = YubicoClient.getPublicId(otp);
  
                  if (this.registry.isYubiKeyRegisteredFor(uid, publicId)) {
                      final YubicoResponse response = client.verify(otp);
                      log.debug("YubiKey response status {} at {}", response.getStatus(), response.getTimestamp());
                      return (response.getStatus() == YubicoResponseStatus.OK);
  
                  }
                  else {
                      log.debug("YubiKey public id [{}] is not registered for user [{}]", publicId, uid);
                  }
              }
              else {
                  log.debug("Invalid OTP format [{}]", otp);
              }
              return false;
          }
          catch (final Exception e) {
              throw new BadUsernameOrPasswordAuthenticationException(e);
          }
  
      }
docs: {@inheritDoc}
  <p/>
  Attempts to authenticate the received credentials using the Yubico cloud validation platform.
  In this implementation, the {@link org.jasig.cas.authentication.principal.UsernamePasswordCredentials#getUsername()}
  is mapped to the <code>uid</code> which will be used by the plugged-in instance of the {@link YubiKeyAccountRegistry}
  and the {@link org.jasig.cas.authentication.principal.UsernamePasswordCredentials#getPassword()} is the received
  one-time password token issued sby the YubiKey device.
  
  @param usernamePasswordCredentials
  
  @return true if the authentication succeeds. False, otherwise.
  
  @throws AuthenticationException