Package io.smallrye.jwt.auth.principal
Class DefaultJWTParser
- java.lang.Object
-
- io.smallrye.jwt.auth.principal.DefaultJWTParser
-
-
Constructor Summary
Constructors Constructor Description DefaultJWTParser()Default 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 providedJWTAuthContextInfoandJWTCallerPrincipalFactoryDefaultJWTParser(JWTCallerPrincipalFactory factory)Constructor which initializes DefaultJWTParser with the providedJWTCallerPrincipalFactoryand a new instance ofJWTAuthContextInfo
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.microprofile.jwt.JsonWebTokendecrypt(String bearerToken, String secret)Parse JWT token.org.eclipse.microprofile.jwt.JsonWebTokendecrypt(String bearerToken, PrivateKey key)Parse JWT token.org.eclipse.microprofile.jwt.JsonWebTokendecrypt(String bearerToken, SecretKey key)Parse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenparse(String bearerToken)Parse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenparse(String bearerToken, JWTAuthContextInfo newAuthContextInfo)Parse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenparseOnly(String token)Parse an already verified signed JWT token.org.eclipse.microprofile.jwt.JsonWebTokenverify(String bearerToken, String secret)Parse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenverify(String bearerToken, PublicKey key)Parse JWT token.org.eclipse.microprofile.jwt.JsonWebTokenverify(String bearerToken, SecretKey key)Parse JWT token.
-
-
-
Constructor Detail
-
DefaultJWTParser
public DefaultJWTParser()
Default constructor which is required to support a JWTParser injection
-
DefaultJWTParser
public DefaultJWTParser(JWTAuthContextInfo authContextInfo)
Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfoand a new instance ofJWTCallerPrincipalFactory- Parameters:
authContextInfo-JWTAuthContextInfo
-
DefaultJWTParser
public DefaultJWTParser(JWTCallerPrincipalFactory factory)
Constructor which initializes DefaultJWTParser with the providedJWTCallerPrincipalFactoryand a new instance ofJWTAuthContextInfo- Parameters:
factory-JWTCallerPrincipalFactory
-
DefaultJWTParser
public DefaultJWTParser(JWTAuthContextInfo authContextInfo, JWTCallerPrincipalFactory factory)
Constructor which initializes DefaultJWTParser with the providedJWTAuthContextInfoandJWTCallerPrincipalFactory- Parameters:
authContextInfo-JWTAuthContextInfofactory-JWTCallerPrincipalFactory
-
-
Method Detail
-
parse
public org.eclipse.microprofile.jwt.JsonWebToken parse(String bearerToken) throws ParseException
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
public org.eclipse.microprofile.jwt.JsonWebToken parseOnly(String token) throws ParseException
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
-
-