gpt4 book ai didi

com.jetdrone.vertx.yoke.YokeSecurity类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 01:59:31 26 4
gpt4 key购买 nike

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

YokeSecurity介绍

暂无

代码示例

代码示例来源:origin: pmlopes/yoke

public JWT(final YokeSecurity security) {
  Map<String, Crypto> tmp = new HashMap<>();
  try {
    tmp.put("HS256", new CryptoMac(security.getMac("HS256")));
  } catch (RuntimeException e) {
    // Algorithm not supported
  }
  try {
    tmp.put("HS384", new CryptoMac(security.getMac("HS384")));
  } catch (RuntimeException e) {
    // Algorithm not supported
  }
  try {
    tmp.put("HS512", new CryptoMac(security.getMac("HS512")));
  } catch (RuntimeException e) {
    // Algorithm not supported
  }
  try {
    tmp.put("RS256", new CryptoSignature(security.getSignature("RS256")));
  } catch (RuntimeException e) {
    // Algorithm not supported
  }
  CRYPTO_MAP = Collections.unmodifiableMap(tmp);
}

代码示例来源:origin: pmlopes/yoke

/**
 * Returns the original value is the signature is correct. Null otherwise.
 */
public static String unsign(@NotNull String val, @NotNull Mac mac) {
  int idx = val.lastIndexOf('.');
  if (idx == -1) {
    return null;
  }
  String str = val.substring(0, idx);
  if (val.equals(sign(str, mac))) {
    return str;
  }
  return null;
}

代码示例来源:origin: pmlopes/yoke

public YokeCookie(@NotNull final Cookie nettyCookie, final Mac mac) {
  this.nettyCookie = nettyCookie;
  this.mac = mac;
  // get the original value
  value = nettyCookie.value();
  // if the prefix is there then it is signed
  if (value.startsWith("s:")) {
    signed = true;
    // if it is signed get the unsigned value
    if (mac == null) {
      // this is an error
      value = null;
    } else {
      value = YokeSecurity.unsign(value.substring(2), mac);
    }
  }
}

代码示例来源:origin: pmlopes/yoke

app.secretSecurity("keyboard cat");
final Mac hmac = app.security().getMac("HmacSHA256");

代码示例来源:origin: pmlopes/yoke

public void sign() {
  if (mac != null) {
    nettyCookie.setValue("s:" + YokeSecurity.sign(value, mac));
    signed = true;
  } else {
    signed = false;
  }
}

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