public class JwtEncryptor extends LogSupport
使用加密器功能需提供RSA私钥作为加密密钥
使用验证器功能需提供RSA公钥作为校验密钥
logger| 构造器和说明 |
|---|
JwtEncryptor() |
| 限定符和类型 | 方法和说明 |
|---|---|
org.springframework.security.jwt.Jwt |
decode(String jwtStr)
解码并校验JWT字符串
|
<T extends JwtClaims> |
decode(String jwtStr,
Class<T> claimsType)
解码并校验JWT字符串,并把JWT的Claims以对象形式返回
|
org.springframework.security.jwt.Jwt |
encode(JwtClaims claims)
生成JWT
|
void |
setSigningKey(String rsaPrivateKey) |
void |
setVerifierKey(String rsaPublicKey) |
public void setSigningKey(String rsaPrivateKey)
public void setVerifierKey(String rsaPublicKey)
public org.springframework.security.jwt.Jwt encode(JwtClaims claims)
claims - Claims对象public org.springframework.security.jwt.Jwt decode(String jwtStr) throws InvalidJwtException
jwtStr - JWT字符串InvalidJwtException - 验证不通过public <T extends JwtClaims> T decode(String jwtStr, Class<T> claimsType) throws InvalidJwtException
T - JwtClaimsjwtStr - JWT字符串claimsType - claims对应的对象类型InvalidJwtException - 验证不通过Copyright © 2017. All rights reserved.