本文整理了Java中io.jsonwebtoken.Claims.getAudience()
方法的一些代码示例,展示了Claims.getAudience()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Claims.getAudience()
方法的具体详情如下:
包路径:io.jsonwebtoken.Claims
类名称:Claims
方法名:getAudience
[英]Returns the JWT aud
(audience) value or null if not present.
[中]返回JWTaud
(访问群体)值,如果不存在,则返回null。
代码示例来源:origin: stylefeng/Guns
/**
* 获取jwt接收者
*/
public static String getAudienceFromToken(String token) {
return getClaimFromToken(token).getAudience();
}
代码示例来源:origin: qiurunze123/GEEKQ-CM
/**
* 获取jwt接收者
*/
public String getAudienceFromToken(String token) {
return getClaimFromToken(token).getAudience();
}
代码示例来源:origin: bfwg/springboot-jwt-starter
public String getAudienceFromToken(String token) {
String audience;
try {
final Claims claims = this.getAllClaimsFromToken(token);
audience = claims.getAudience();
} catch (Exception e) {
audience = null;
}
return audience;
}
代码示例来源:origin: qiurunze123/GEEKQ-CM
/**
* 获取jwt接收者
*/
public String getAudienceFromToken(String token) {
return getClaimFromToken(token).getAudience();
}
代码示例来源:origin: qiurunze123/GEEKQ-CM
/**
* 获取jwt接收者
*/
public String getAudienceFromToken(String token) {
return getClaimFromToken(token).getAudience();
}
代码示例来源:origin: qiurunze123/GEEKQ-CM
/**
* 获取jwt接收者
*/
public String getAudienceFromToken(String token) {
return getClaimFromToken(token).getAudience();
}
代码示例来源:origin: qiurunze123/GEEKQ-CM
/**
* 获取jwt接收者
*/
public String getAudienceFromToken(String token) {
return getClaimFromToken(token).getAudience();
}
代码示例来源:origin: qiurunze123/GEEKQ-CM
/**
* 获取jwt接收者
*/
public String getAudienceFromToken(String token) {
return getClaimFromToken(token).getAudience();
}
代码示例来源:origin: cn.org.faster/faster-web
/**
* 验证图形验证码是否有效
*
* @param captcha 验证码
* @param token token
* @return true or false
*/
public boolean valid(String captcha, String token) {
Claims claims = jwtService.parseToken(token);
return claims != null && (CAPTCHA_TOKEN_PREFIX + Utils.md5(captcha)).equalsIgnoreCase(claims.getAudience());
}
代码示例来源:origin: opencb/opencga
String getAudience(String jwtKey) throws CatalogAuthenticationException {
return parseClaims(jwtKey).getBody().getAudience();
}
代码示例来源:origin: io.interface21/ameba-lib
if (!tenantEO.get().getName().equals(jws.getBody().getAudience())) {
throw new InvalidTokenException("The token has been issued for some other audience, is the token leaked or replayed?");
代码示例来源:origin: cn.org.faster/faster-admin
throw new AuthenticationException(BasisErrorCode.TOKEN_INVALID.getDescription());
SysUser user = sysUserService.info(Long.parseLong(claims.getAudience()));
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
if (user == null) {
代码示例来源:origin: cn.org.faster/faster-web
Claims claims = authService.parseToken(jwtToken);
if (claims != null) {
String userId = claims.getAudience();
代码示例来源:origin: cn.org.faster/faster-admin
throw new AuthenticationException(BasisErrorCode.TOKEN_INVALID.getDescription());
String userId = claims.getAudience();
if (!authService.isMultipartTerminal()) {
String cacheToken = CacheFacade.get(AuthService.AUTH_TOKEN_PREFIX + userId);
代码示例来源:origin: tomsun28/bootshiro
/**
* 验签JWT
*
* @param jwt json web token
*/
public static JwtAccount parseJwt(String jwt, String appKey) throws ExpiredJwtException, UnsupportedJwtException, MalformedJwtException, SignatureException, IllegalArgumentException {
Claims claims = Jwts.parser()
.setSigningKey(DatatypeConverter.parseBase64Binary(appKey))
.parseClaimsJws(jwt)
.getBody();
JwtAccount jwtAccount = new JwtAccount();
jwtAccount.setTokenId(claims.getId());// 令牌ID
jwtAccount.setAppId(claims.getSubject());// 客户标识
jwtAccount.setIssuer(claims.getIssuer());// 签发者
jwtAccount.setIssuedAt(claims.getIssuedAt());// 签发时间
jwtAccount.setAudience(claims.getAudience());// 接收方
jwtAccount.setRoles(claims.get("roles", String.class));// 访问主张-角色
jwtAccount.setPerms(claims.get("perms", String.class));// 访问主张-权限
return jwtAccount;
}
代码示例来源:origin: line/line-sdk-android
@NonNull
private static LineIdToken buildIdToken(final Claims claims) {
return new LineIdToken.Builder()
.issuer(claims.getIssuer())
.subject(claims.getSubject())
.audience(claims.getAudience())
.expiresAt(claims.getExpiration())
.issuedAt(claims.getIssuedAt())
.authTime(claims.get("auth_time", Date.class))
.nonce(claims.get("nonce", String.class))
.name(claims.get("name", String.class))
.picture(claims.get("picture", String.class))
.phoneNumber(claims.get("phone_number", String.class))
.email(claims.get("email", String.class))
.gender(claims.get("gender", String.class))
.birthdate(claims.get("birthdate", String.class))
.address(buildAddress(claims))
.givenName(claims.get("given_name", String.class))
.givenNamePronunciation(claims.get("given_name_pronunciation", String.class))
.middleName(claims.get("middle_name", String.class))
.familyName(claims.get("family_name", String.class))
.familyNamePronunciation(claims.get("family_name_pronunciation", String.class))
.build();
}
内容来源于网络,如有侵权,请联系作者删除!