jaas/src/main/java/com/yubico/jaas/YubikeyLoginModule.java
private boolean validate_otps(List<String> otps, NameCallback nameCb) throws LoginException {
		boolean validated = false;

		for (String otp : otps) {
			log.trace("Checking OTP {}", otp);

			VerificationResponse ykr;
			try {
				ykr = this.yc.verify(otp);
			} catch (YubicoVerificationException e) {
				log.warn("Errors during validation: ", e);
				throw new LoginException("Errors during validation: " + e.getMessage());
			} catch (YubicoValidationFailure e) {
				log.warn("Something went very wrong during authentication: ", e);
				throw new LoginException("Something went very wrong during authentication: " + e.getMessage());
			}
			if (ykr != null) {
				log.trace("OTP {} verify result : {}", otp, ykr.getStatus().toString());
				if (ykr.getStatus() == ResponseStatus.OK) {
					String publicId = YubicoClient.getPublicId(otp);
					log.info("OTP verified successfully (YubiKey id {})", publicId);
					if (is_right_user(nameCb.getName(), publicId)) {
						this.principals.add(new YubikeyPrincipal(publicId, this.idRealm));
						/* Don't just return here, we want to "consume" all OTPs if
						 * more than one is provided.
						 */
						validated = true;
					}
				} else {
					log.debug("OTP validation returned {}", ykr.getStatus().toString());
				}
			}
		}

		return validated;
	}
private boolean validate_otps(List<String> otps, NameCallback nameCb) throws LoginException {
		boolean validated = false;

		for (String otp : otps) {
			log.trace("Checking OTP {}", otp);

			VerificationResponse ykr;
			try {
				ykr = this.yc.verify(otp);
			} catch (YubicoVerificationException e) {
				log.warn("Errors during validation: ", e);
				throw new LoginException("Errors during validation: " + e.getMessage());
			} catch (YubicoValidationFailure e) {
				log.warn("Something went very wrong during authentication: ", e);
				throw new LoginException("Something went very wrong during authentication: " + e.getMessage());
			}
			if (ykr != null) {
				log.trace("OTP {} verify result : {}", otp, ykr.getStatus().toString());
				if (ykr.getStatus() == ResponseStatus.OK) {
					String publicId = YubicoClient.getPublicId(otp);
					log.info("OTP verified successfully (YubiKey id {})", publicId);
					if (is_right_user(nameCb.getName(), publicId)) {
						this.principals.add(new YubikeyPrincipal(publicId, this.idRealm));
						/* Don't just return here, we want to "consume" all OTPs if
						 * more than one is provided.
						 */
						validated = true;
					}
				} else {
					log.debug("OTP validation returned {}", ykr.getStatus().toString());
				}
			}
		}

		return validated;
	}
Try to validate all the OTPs provided.
@param otps  Possible YubiKey OTPs
@param nameCb  JAAS callback to get authenticating username
@return  true if one or more of the OTPs validated OK, otherwise false
@throws LoginException for exceptions during validation, logging real exception at warn level