public class SignedWithHamcJWTRepository extends Object implements JwtRepository<String>
| 构造器和说明 |
|---|
SignedWithHamcJWTRepository() |
| 限定符和类型 | 方法和说明 |
|---|---|
JwtPayload |
getPlayload(String signingKey,
String token,
boolean checkExpiry)
Parser JSON Web Token (JWT)
|
JwtTimeProvider |
getTimeProvider() |
String |
issueJwt(String signingKey,
String jwtId,
String subject,
String issuer,
String audience,
Map<String,Object> claims,
String algorithm,
long period)
Issue JSON Web Token (JWT)
|
String |
issueJwt(String signingKey,
String jwtId,
String subject,
String issuer,
String audience,
String roles,
String permissions,
String algorithm,
long period)
Issue JSON Web Token (JWT)
|
void |
setTimeProvider(JwtTimeProvider timeProvider) |
boolean |
verify(String signingKey,
String token,
boolean checkExpiry)
Verify the validity of JWT
|
public String issueJwt(String signingKey, String jwtId, String subject, String issuer, String audience, String roles, String permissions, String algorithm, long period) throws JwtException
issueJwt 在接口中 JwtRepository<String>signingKey - : Signing keyjwtId - : Jwt Idsubject - : Jwt Subjectissuer - : Jwt Issueraudience - : Jwt Audienceroles - : The Rolespermissions - : The Permsalgorithm - : Supported algorithms:
HS256 - HMAC with SHA-256, requires 256+ bit secret
HS384 - HMAC with SHA-384, requires 384+ bit secret
HS512 - HMAC with SHA-512, requires 512+ bit secret
period - : Jwt Expiration CycleJwtException - When Authentication Exceptionpublic String issueJwt(String signingKey, String jwtId, String subject, String issuer, String audience, Map<String,Object> claims, String algorithm, long period) throws JwtException
issueJwt 在接口中 JwtRepository<String>signingKey - : Signing keyjwtId - : Jwt Idsubject - : Jwt Subjectissuer - : Jwt Issueraudience - : Jwt Audienceclaims - : Jwt Claimsalgorithm - : Supported algorithms:
HS256 - HMAC with SHA-256, requires 256+ bit secret
HS384 - HMAC with SHA-384, requires 384+ bit secret
HS512 - HMAC with SHA-512, requires 512+ bit secret
period - : Jwt Expiration CycleJwtException - When Authentication Exceptionpublic boolean verify(String signingKey, String token, boolean checkExpiry) throws JwtException
verify 在接口中 JwtRepository<String>signingKey - :
If the jws was signed with a SecretKey, the same SecretKey should be specified on the JwtParser.
If the jws was signed with a PrivateKey, that key's corresponding PublicKey (not the PrivateKey) should be specified on the JwtParser.
token - : JSON Web Token (JWT)checkExpiry - : If Check validity.JwtException - When Authentication Exceptionpublic JwtPayload getPlayload(String signingKey, String token, boolean checkExpiry) throws JwtException
getPlayload 在接口中 JwtRepository<String>signingKey - :
If the jws was signed with a SecretKey, the same SecretKey should be specified on the JwtParser.
If the jws was signed with a PrivateKey, that key's corresponding PublicKey (not the PrivateKey) should be specified on the JwtParser.
token - : JSON Web Token (JWT)checkExpiry - : If Check validity.JwtPayloadJwtException - When Authentication Exceptionpublic JwtTimeProvider getTimeProvider()
public void setTimeProvider(JwtTimeProvider timeProvider)
Copyright © 2019. All rights reserved.