本文整理了Java中io.jsonwebtoken.Claims.setId()
方法的一些代码示例,展示了Claims.setId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Claims.setId()
方法的具体详情如下:
包路径:io.jsonwebtoken.Claims
类名称:Claims
方法名:setId
暂无
代码示例来源:origin: jwtk/jjwt
@Override
public JwtParser requireId(String id) {
expectedClaims.setId(id);
return this;
}
代码示例来源:origin: jwtk/jjwt
@Override
public JwtBuilder setId(String jti) {
if (Strings.hasText(jti)) {
ensureClaims().setId(jti);
} else {
if (this.claims != null) {
claims.setId(jti);
}
}
return this;
}
代码示例来源:origin: io.jsonwebtoken/jjwt
@Override
public JwtParser requireId(String id) {
expectedClaims.setId(id);
return this;
}
代码示例来源:origin: io.jsonwebtoken/jjwt-impl
@Override
public JwtParser requireId(String id) {
expectedClaims.setId(id);
return this;
}
代码示例来源:origin: io.jsonwebtoken/jjwt
@Override
public JwtBuilder setId(String jti) {
if (Strings.hasText(jti)) {
ensureClaims().setId(jti);
} else {
if (this.claims != null) {
claims.setId(jti);
}
}
return this;
}
代码示例来源:origin: io.jsonwebtoken/jjwt-impl
@Override
public JwtBuilder setId(String jti) {
if (Strings.hasText(jti)) {
ensureClaims().setId(jti);
} else {
if (this.claims != null) {
claims.setId(jti);
}
}
return this;
}
代码示例来源:origin: craftingjava/springuni-particles
@Override
public String createJwtToken(Authentication authentication, int minutes) {
Claims claims = Jwts.claims()
.setId(String.valueOf(IdentityGenerator.generate()))
.setSubject(authentication.getName())
.setExpiration(new Date(currentTimeMillis() + minutes * 60 * 1000))
.setIssuedAt(new Date());
String authorities = authentication.getAuthorities()
.stream()
.map(GrantedAuthority::getAuthority)
.map(String::toUpperCase)
.collect(Collectors.joining(","));
claims.put(AUTHORITIES, authorities);
return Jwts.builder()
.setClaims(claims)
.signWith(HS512, secretkey)
.compact();
}
代码示例来源:origin: Jasig/uPortal
protected Claims createClaims(
Class<? extends ITokenizable> clazz, String username, Date expires) {
// Registered claims
final Claims rslt =
Jwts.claims()
.setIssuer(JWT_ISSUER)
.setSubject(username)
.setExpiration(expires)
.setIssuedAt(new Date())
.setId(UUID.randomUUID().toString());
// Deserialization class
rslt.put(JwtClaims.CLASS.getName(), clazz.getName());
return rslt;
}
代码示例来源:origin: craftingjava/springuni-particles
@Override
protected String encodeCookie(String[] cookieTokens) {
Claims claims = Jwts.claims()
.setId(cookieTokens[0])
.setSubject(cookieTokens[1])
.setExpiration(new Date(currentTimeMillis() + getTokenValiditySeconds() * 1000L))
.setIssuedAt(new Date());
return Jwts.builder()
.setClaims(claims)
.signWith(HS512, getKey())
.compact();
}
内容来源于网络,如有侵权,请联系作者删除!