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 a
JsonWebToken.-
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.microprofile.jwt.JsonWebTokenParse JWT token.org.eclipse.microprofile.jwt.JsonWebTokendecrypt(String token, PrivateKey key) Parse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenParse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenParse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenparse(String token, JWTAuthContextInfo context) Parse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenParse an already verified signed JWT token.org.eclipse.microprofile.jwt.JsonWebTokenParse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenParse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenParse JWT token.
-
Method Details
-
parse
Parse JWT token. The token will be verified or decrypted or decrypted and then verified and converted toJsonWebToken. This method depends on the injectedJWTAuthContextInfoconfiguration 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 injectedJWTAuthContextInfoconfiguration context.- Returns:
- JsonWebToken
- Throws:
ParseException- parse exception
-
verify
Parse JWT token. The token will be verified and converted toJsonWebToken.- Parameters:
token- the JWT tokenkey- the public verification key. The injectedJWTAuthContextInfoconfiguration context will be reused, only its publicVerificationKey property will be replaced by this parameter.- Returns:
- JsonWebToken
- Throws:
ParseException- parse exception
-
verify
Parse JWT token. The token will be verified and converted toJsonWebToken.- Parameters:
token- the JWT tokenkey- the secret verification key. The injectedJWTAuthContextInfoconfiguration context will be reused, only its secretVerificationKey property will be replaced by this parameter.- Returns:
- JsonWebToken
- Throws:
ParseException- parse exception
-
verify
Parse JWT token. The token will be verified and converted toJsonWebToken.- Parameters:
token- the JWT tokensecret- the secret. The injectedJWTAuthContextInfoconfiguration 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 injectedJWTAuthContextInfoconfiguration 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 injectedJWTAuthContextInfoconfiguration 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 injectedJWTAuthContextInfoconfiguration 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
-
parseOnly
Parse an already verified signed JWT token. Use this method only if the token has been verified by the secure gateway or other systems.- Throws:
ParseException
-