本文整理了Java中com.yubico.client.v2.YubicoClient.getClient()
方法的一些代码示例,展示了YubicoClient.getClient()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YubicoClient.getClient()
方法的具体详情如下:
包路径:com.yubico.client.v2.YubicoClient
类名称:YubicoClient
方法名:getClient
[英]Instantiate a YubicoClient object.
[中]
代码示例来源:origin: net.unicon.cas/cas-addons
/**
* Prepares the Yubico client with the received clientId and secretKey. By default,
* all YubiKey accounts are allowed to authenticate.
* <p/>
* WARNING: THIS CONSTRUCTOR RESULTS IN AN EXAMPLE YubiKeyAuthenticationHandler
* CONFIGURATION THAT CONSIDERS ALL Yubikeys VALID FOR ALL USERS. YOU MUST NOT USE
* THIS CONSTRUCTOR IN PRODUCTION.
*
* @param clientId
* @param secretKey
*/
public YubiKeyAuthenticationHandler(final Integer clientId, final String secretKey) {
this.client = YubicoClient.getClient(clientId);
this.client.setKey(secretKey);
}
代码示例来源:origin: Yubico/yubico-java-client
public static void main (String args []) throws Exception
{
if (args.length != 3) {
System.err.println("\n*** Test your Yubikey against Yubico OTP validation server ***");
System.err.println("\nUsage: java -jar client.jar Client_ID Client_key OTP");
System.err.println("\nEg. java -jar client.jar 28 vvfucnlcrrnejlbuthlktguhclhvegbungldcrefbnku");
System.err.println("\nTouch Yubikey to generate the OTP. Visit Yubico.com for more details.");
return;
}
String otp = args[2];
YubicoClient yc = YubicoClient.getClient(Integer.parseInt(args[0]), args[1]);
VerificationResponse response = yc.verify(otp);
if(response!=null && response.getStatus() == ResponseStatus.OK) {
System.out.println("\n* OTP verified OK");
} else {
System.out.println("\n* Failed to verify OTP");
}
System.out.println("\n* Last response: " + response);
System.exit(0);
} // End of main
代码示例来源:origin: Yubico/yubico-java-client
this.yc = YubicoClient.getClient(clientId, clientKey);
代码示例来源:origin: org.apereo.cas/cas-server-support-yubikey
@RefreshScope
@Bean
@ConditionalOnMissingBean(name = "yubicoClient")
public YubicoClient yubicoClient() {
val yubi = this.casProperties.getAuthn().getMfa().getYubikey();
if (StringUtils.isBlank(yubi.getSecretKey())) {
throw new IllegalArgumentException("Yubikey secret key cannot be blank");
}
if (yubi.getClientId() <= 0) {
throw new IllegalArgumentException("Yubikey client id is undefined");
}
val client = YubicoClient.getClient(yubi.getClientId(), yubi.getSecretKey());
if (!yubi.getApiUrls().isEmpty()) {
val urls = yubi.getApiUrls().toArray(ArrayUtils.EMPTY_STRING_ARRAY);
client.setWsapiUrls(urls);
}
return client;
}
内容来源于网络,如有侵权,请联系作者删除!