本文整理了Java中com.yubico.client.v2.exceptions.YubicoValidationFailure
类的一些代码示例,展示了YubicoValidationFailure
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YubicoValidationFailure
类的具体详情如下:
包路径:com.yubico.client.v2.exceptions.YubicoValidationFailure
类名称:YubicoValidationFailure
[英]This is thrown for validation failures
代码示例来源:origin: Yubico/yubico-java-client
private void verifySignature(VerificationResponse response) throws YubicoValidationFailure, YubicoVerificationException {
StringBuilder keyValueStr = new StringBuilder();
for (Entry<String, String> entry : response.getKeyValueMap().entrySet()) {
if ("h".equals(entry.getKey())) {
continue;
}
if (keyValueStr.length() > 0) {
keyValueStr.append("&");
}
keyValueStr
.append(entry.getKey())
.append("=")
.append(entry.getValue());
}
try {
String signature = Signature.calculate(keyValueStr.toString(), key).trim();
if (!response.getH().equals(signature) &&
!response.getStatus().equals(BAD_SIGNATURE)) {
// don't throw a ValidationFailure if the server said bad signature, in that
// case we probably have the wrong key/id and want to check it.
throw new YubicoValidationFailure("Signatures do not match");
}
} catch (YubicoSignatureException e) {
throw new YubicoVerificationException("Failed to calculate the response signature.", e);
}
}
代码示例来源:origin: Yubico/yubico-java-client
} catch (YubicoValidationFailure e) {
log.warn("Something went very wrong during authentication: ", e);
throw new LoginException("Something went very wrong during authentication: " + e.getMessage());
代码示例来源:origin: Yubico/yubico-java-client
throw new YubicoValidationFailure("OTP mismatch in response, is there a man-in-the-middle?");
throw new YubicoValidationFailure("Nonce mismatch in response, is there a man-in-the-middle?");
内容来源于网络,如有侵权,请联系作者删除!