gpt4 book ai didi

com.yubico.client.v2.YubicoClient.verify()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 18:10:49 24 4
gpt4 key购买 nike

本文整理了Java中com.yubico.client.v2.YubicoClient.verify()方法的一些代码示例,展示了YubicoClient.verify()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YubicoClient.verify()方法的具体详情如下:
包路径:com.yubico.client.v2.YubicoClient
类名称:YubicoClient
方法名:verify

YubicoClient.verify介绍

[英]Validate an OTP using a webservice call to one or more ykval validation servers.
[中]使用对一个或多个ykval验证服务器的webservice调用验证OTP。

代码示例

代码示例来源:origin: Yubico/yubico-java-client

@Path("register")
@POST
public String register(@FormParam("username") String username, @FormParam("otp") String otp) throws Exception {
  VerificationResponse response = client.verify(otp);
  if (response.isOk()) {
    String yubikeyId = YubicoClient.getPublicId(otp);
    yubikeyIds.put(username, yubikeyId);
    return "Successfully registered YubiKey!" + NAVIGATION;
  }
  return "Invalid OTP: " + response;
}

代码示例来源: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

@Path("login")
  @POST
  public String login(@FormParam("username") String username, @FormParam("otp") String otp) throws Exception {
    VerificationResponse response = client.verify(otp);
    if (response.isOk()) {
      String yubikeyId = YubicoClient.getPublicId(otp);
      if(yubikeyIds.get(username).contains(yubikeyId)) {
        return "Success fully logged in " + username + "!" + NAVIGATION;
      }
      return "No such username and YubiKey combination.";
    }
    return "Invalid OTP: " + response;
  }
}

代码示例来源:origin: org.apereo.cas/cas-server-support-yubikey-core

@Override
  public boolean isValid(final String uid, final String token) {
    try {
      val yubikeyPublicId = getTokenPublicId(token);
      if (StringUtils.isNotBlank(yubikeyPublicId)) {
        val response = this.client.verify(token);
        val status = response.getStatus();
        if (status.compareTo(ResponseStatus.OK) == 0) {
          LOGGER.debug("YubiKey response status [{}] at [{}]", status, response.getTimestamp());
          return true;
        }
        LOGGER.error("Failed to verify YubiKey token: [{}]", response);
      } else {
        LOGGER.error("Invalid YubiKey token: [{}]", token);
      }
    } catch (final Exception e) {
      LOGGER.error(e.getMessage(), e);
    }
    return false;
  }
}

代码示例来源:origin: Yubico/yubico-java-client

ykr = this.yc.verify(otp);
} catch (YubicoVerificationException e) {
  log.warn("Errors during validation: ", e);

代码示例来源:origin: org.apereo.cas/cas-server-support-yubikey-core

val response = this.client.verify(otp);
val status = response.getStatus();
if (status.compareTo(ResponseStatus.OK) == 0) {

代码示例来源:origin: net.unicon.cas/cas-addons

final YubicoResponse response = client.verify(otp);
log.debug("YubiKey response status {} at {}", response.getStatus(), response.getTimestamp());
return (response.getStatus() == YubicoResponseStatus.OK);

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com