com.nimbusds.jwt.JWT.getParsedString()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(273)

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

JWT.getParsedString介绍

[英]Gets the original parsed string used to create the JSON Web Token (JWT).
[中]获取用于创建JSON Web令牌(JWT)的原始解析字符串。

代码示例

代码示例来源:origin: spring-projects/spring-security

private Jwt createJwt(JWT parsedJwt, JWTClaimsSet jwtClaimsSet) {
  Map<String, Object> headers = new LinkedHashMap<>(parsedJwt.getHeader().toJSONObject());
  Map<String, Object> claims = this.claimSetConverter.convert(jwtClaimsSet.getClaims());
  Instant expiresAt = (Instant) claims.get(JwtClaimNames.EXP);
  Instant issuedAt = (Instant) claims.get(JwtClaimNames.IAT);
  return new Jwt(parsedJwt.getParsedString(), issuedAt, expiresAt, headers, claims);
}

代码示例来源:origin: org.springframework.security/spring-security-oauth2-jose

private Jwt createJwt(JWT parsedJwt, JWTClaimsSet jwtClaimsSet) {
  Instant expiresAt = null;
  if (jwtClaimsSet.getExpirationTime() != null) {
    expiresAt = jwtClaimsSet.getExpirationTime().toInstant();
  }
  Instant issuedAt = null;
  if (jwtClaimsSet.getIssueTime() != null) {
    issuedAt = jwtClaimsSet.getIssueTime().toInstant();
  } else if (expiresAt != null) {
    // Default to expiresAt - 1 second
    issuedAt = Instant.from(expiresAt).minusSeconds(1);
  }
  Map<String, Object> headers = new LinkedHashMap<>(parsedJwt.getHeader().toJSONObject());
  return new Jwt(parsedJwt.getParsedString(), issuedAt, expiresAt, headers, jwtClaimsSet.getClaims());
}

代码示例来源:origin: org.pac4j/pac4j-oidc

profile.setAccessToken(accessToken);
final JWT idToken = credentials.getIdToken();
profile.setIdTokenString(idToken.getParsedString());

相关文章