Package io.smallrye.jwt.auth.principal
Interface JWTParser
-
- All Known Implementing Classes:
DefaultJWTParser
public interface JWTParser
A parser to parse a JWT token and convert it to aJsonWebToken
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.eclipse.microprofile.jwt.JsonWebToken
decrypt(String token, String secret)
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
decrypt(String token, PrivateKey key)
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
decrypt(String token, SecretKey key)
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
parse(String token)
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
parse(String token, JWTAuthContextInfo context)
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
verify(String token, String secret)
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
verify(String token, PublicKey key)
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
verify(String token, SecretKey key)
Parse JWT token.
-
-
-
Method Detail
-
parse
org.eclipse.microprofile.jwt.JsonWebToken parse(String token) throws ParseException
Parse JWT token. The token will be verified or decrypted or decrypted and then verified and converted toJsonWebToken
. This method depends on the injectedJWTAuthContextInfo
configuration context.- Parameters:
token
- the JWT token- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
parse
org.eclipse.microprofile.jwt.JsonWebToken parse(String token, JWTAuthContextInfo context) throws ParseException
Parse JWT token. The token will be verified or decrypted or decrypted and then verified and converted toJsonWebToken
.- Parameters:
token
- the JWT tokencontext
- the configuration context which will override the injectedJWTAuthContextInfo
configuration context.- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
verify
org.eclipse.microprofile.jwt.JsonWebToken verify(String token, PublicKey key) throws ParseException
Parse JWT token. The token will be verified and converted toJsonWebToken
.- Parameters:
token
- the JWT tokenkey
- the public verification key. The injectedJWTAuthContextInfo
configuration context will be reused, only its publicVerificationKey property will be replaced by this parameter.- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
verify
org.eclipse.microprofile.jwt.JsonWebToken verify(String token, SecretKey key) throws ParseException
Parse JWT token. The token will be verified and converted toJsonWebToken
.- Parameters:
token
- the JWT tokenkey
- the secret verification key. The injectedJWTAuthContextInfo
configuration context will be reused, only its secretVerificationKey property will be replaced by this parameter.- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
verify
org.eclipse.microprofile.jwt.JsonWebToken verify(String token, String secret) throws ParseException
Parse JWT token. The token will be verified and converted toJsonWebToken
.- Parameters:
token
- the JWT tokensecret
- the secret. The injectedJWTAuthContextInfo
configuration context will be reused, only its secretVerificationKey property will be replaced after converting this parameter toSecretKey
.- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
decrypt
org.eclipse.microprofile.jwt.JsonWebToken decrypt(String token, PrivateKey key) throws ParseException
Parse JWT token. The token will be decrypted and converted toJsonWebToken
.- Parameters:
token
- the JWT tokenkey
- the private decryption key. The injectedJWTAuthContextInfo
configuration context will be reused, only its privateDecryptionkey property will be replaced by this parameter.- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
decrypt
org.eclipse.microprofile.jwt.JsonWebToken decrypt(String token, SecretKey key) throws ParseException
Parse JWT token. The token will be decrypted and converted toJsonWebToken
.- Parameters:
token
- the JWT tokenkey
- the secret decryption key. The injectedJWTAuthContextInfo
configuration context will be reused, only its secretDecryptionkey property will be replaced by this parameter.- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
decrypt
org.eclipse.microprofile.jwt.JsonWebToken decrypt(String token, String secret) throws ParseException
Parse JWT token. The token will be decrypted and converted toJsonWebToken
.- Parameters:
token
- the JWT tokensecret
- the secret. The injectedJWTAuthContextInfo
configuration context will be reused, only its secretDecryptionkey property will be replaced will be replaced after converting this parameter toSecretKey
.- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
-