Package io.smallrye.jwt.auth.principal
Class DefaultJWTParser
java.lang.Object
io.smallrye.jwt.auth.principal.DefaultJWTParser
- All Implemented Interfaces:
JWTParser
A default implementation of
JWTParser
.-
Constructor Summary
ConstructorDescriptionDefault constructor which is required to support a JWTParser injectionDefaultJWTParser
(JWTAuthContextInfo authContextInfo) Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfo
and a new instance ofJWTCallerPrincipalFactory
DefaultJWTParser
(JWTAuthContextInfo authContextInfo, JWTCallerPrincipalFactory factory) Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfo
andJWTCallerPrincipalFactory
Constructor which initializes DefaultJWTParser with the providedJWTCallerPrincipalFactory
and a new instance ofJWTAuthContextInfo
-
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.microprofile.jwt.JsonWebToken
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
decrypt
(String bearerToken, PrivateKey key) Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
parse
(String bearerToken, JWTAuthContextInfo newAuthContextInfo) Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
Parse an already verified signed JWT token.org.eclipse.microprofile.jwt.JsonWebToken
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
Parse JWT token.org.eclipse.microprofile.jwt.JsonWebToken
Parse JWT token.
-
Constructor Details
-
DefaultJWTParser
public DefaultJWTParser()Default constructor which is required to support a JWTParser injection -
DefaultJWTParser
Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfo
and a new instance ofJWTCallerPrincipalFactory
- Parameters:
authContextInfo
-JWTAuthContextInfo
-
DefaultJWTParser
Constructor which initializes DefaultJWTParser with the providedJWTCallerPrincipalFactory
and a new instance ofJWTAuthContextInfo
- Parameters:
factory
-JWTCallerPrincipalFactory
-
DefaultJWTParser
Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfo
andJWTCallerPrincipalFactory
- Parameters:
authContextInfo
-JWTAuthContextInfo
factory
-JWTCallerPrincipalFactory
-
-
Method Details
-
parse
Description copied from interface:JWTParser
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.- Specified by:
parse
in interfaceJWTParser
- Parameters:
bearerToken
- the JWT token- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
parse
public org.eclipse.microprofile.jwt.JsonWebToken parse(String bearerToken, JWTAuthContextInfo newAuthContextInfo) throws ParseException Description copied from interface:JWTParser
Parse JWT token. The token will be verified or decrypted or decrypted and then verified and converted toJsonWebToken
.- Specified by:
parse
in interfaceJWTParser
- Parameters:
bearerToken
- the JWT tokennewAuthContextInfo
- the configuration context which will override the injectedJWTAuthContextInfo
configuration context.- Returns:
- JsonWebToken
- Throws:
ParseException
- parse exception
-
verify
public org.eclipse.microprofile.jwt.JsonWebToken verify(String bearerToken, PublicKey key) throws ParseException Description copied from interface:JWTParser
Parse JWT token. The token will be verified and converted toJsonWebToken
.- Specified by:
verify
in interfaceJWTParser
- Parameters:
bearerToken
- 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
public org.eclipse.microprofile.jwt.JsonWebToken verify(String bearerToken, SecretKey key) throws ParseException Description copied from interface:JWTParser
Parse JWT token. The token will be verified and converted toJsonWebToken
.- Specified by:
verify
in interfaceJWTParser
- Parameters:
bearerToken
- 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
public org.eclipse.microprofile.jwt.JsonWebToken verify(String bearerToken, String secret) throws ParseException Description copied from interface:JWTParser
Parse JWT token. The token will be verified and converted toJsonWebToken
.- Specified by:
verify
in interfaceJWTParser
- Parameters:
bearerToken
- 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
public org.eclipse.microprofile.jwt.JsonWebToken decrypt(String bearerToken, PrivateKey key) throws ParseException Description copied from interface:JWTParser
Parse JWT token. The token will be decrypted and converted toJsonWebToken
.- Specified by:
decrypt
in interfaceJWTParser
- Parameters:
bearerToken
- 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
public org.eclipse.microprofile.jwt.JsonWebToken decrypt(String bearerToken, SecretKey key) throws ParseException Description copied from interface:JWTParser
Parse JWT token. The token will be decrypted and converted toJsonWebToken
.- Specified by:
decrypt
in interfaceJWTParser
- Parameters:
bearerToken
- 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
public org.eclipse.microprofile.jwt.JsonWebToken decrypt(String bearerToken, String secret) throws ParseException Description copied from interface:JWTParser
Parse JWT token. The token will be decrypted and converted toJsonWebToken
.- Specified by:
decrypt
in interfaceJWTParser
- Parameters:
bearerToken
- 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
-
parseOnly
Description copied from interface:JWTParser
Parse an already verified signed JWT token. Use this method only if the token has been verified by the secure gateway or other systems.- Specified by:
parseOnly
in interfaceJWTParser
- Throws:
ParseException
-