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
ConstructorsConstructorDescriptionDefault constructor which is required to support a JWTParser injectionDefaultJWTParser(JWTAuthContextInfo authContextInfo) Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfoand a new instance ofJWTCallerPrincipalFactoryDefaultJWTParser(JWTAuthContextInfo authContextInfo, JWTCallerPrincipalFactory factory) Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfoandJWTCallerPrincipalFactoryConstructor which initializes DefaultJWTParser with the providedJWTCallerPrincipalFactoryand a new instance ofJWTAuthContextInfo -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.microprofile.jwt.JsonWebTokenParse JWT token.org.eclipse.microprofile.jwt.JsonWebTokendecrypt(String bearerToken, 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 bearerToken, JWTAuthContextInfo newAuthContextInfo) 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.
-
Constructor Details
-
DefaultJWTParser
public DefaultJWTParser()Default constructor which is required to support a JWTParser injection -
DefaultJWTParser
Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfoand a new instance ofJWTCallerPrincipalFactory- Parameters:
authContextInfo-JWTAuthContextInfo
-
DefaultJWTParser
Constructor which initializes DefaultJWTParser with the providedJWTCallerPrincipalFactoryand a new instance ofJWTAuthContextInfo- Parameters:
factory-JWTCallerPrincipalFactory
-
DefaultJWTParser
Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfoandJWTCallerPrincipalFactory- Parameters:
authContextInfo-JWTAuthContextInfofactory-JWTCallerPrincipalFactory
-
-
Method Details
-
parse
Description copied from interface:JWTParserParse JWT token. The token will be verified or decrypted or decrypted and then verified and converted toJsonWebToken. This method depends on the injectedJWTAuthContextInfoconfiguration context.- Specified by:
parsein 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:JWTParserParse JWT token. The token will be verified or decrypted or decrypted and then verified and converted toJsonWebToken.- Specified by:
parsein interfaceJWTParser- Parameters:
bearerToken- the JWT tokennewAuthContextInfo- the configuration context which will override the injectedJWTAuthContextInfoconfiguration 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:JWTParserParse JWT token. The token will be verified and converted toJsonWebToken.- Specified by:
verifyin interfaceJWTParser- Parameters:
bearerToken- 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
public org.eclipse.microprofile.jwt.JsonWebToken verify(String bearerToken, SecretKey key) throws ParseException Description copied from interface:JWTParserParse JWT token. The token will be verified and converted toJsonWebToken.- Specified by:
verifyin interfaceJWTParser- Parameters:
bearerToken- 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
public org.eclipse.microprofile.jwt.JsonWebToken verify(String bearerToken, String secret) throws ParseException Description copied from interface:JWTParserParse JWT token. The token will be verified and converted toJsonWebToken.- Specified by:
verifyin interfaceJWTParser- Parameters:
bearerToken- 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
public org.eclipse.microprofile.jwt.JsonWebToken decrypt(String bearerToken, PrivateKey key) throws ParseException Description copied from interface:JWTParserParse JWT token. The token will be decrypted and converted toJsonWebToken.- Specified by:
decryptin interfaceJWTParser- Parameters:
bearerToken- 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
public org.eclipse.microprofile.jwt.JsonWebToken decrypt(String bearerToken, SecretKey key) throws ParseException Description copied from interface:JWTParserParse JWT token. The token will be decrypted and converted toJsonWebToken.- Specified by:
decryptin interfaceJWTParser- Parameters:
bearerToken- 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
public org.eclipse.microprofile.jwt.JsonWebToken decrypt(String bearerToken, String secret) throws ParseException Description copied from interface:JWTParserParse JWT token. The token will be decrypted and converted toJsonWebToken.- Specified by:
decryptin interfaceJWTParser- Parameters:
bearerToken- 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
Description copied from interface:JWTParserParse 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:
parseOnlyin interfaceJWTParser- Throws:
ParseException
-