Package tech.lastbox.jwt
Enum Class JwtAlgorithm
- All Implemented Interfaces:
Serializable,Comparable<JwtAlgorithm>,Constable
Enum representing the different JWT signing algorithms.
This enum provides various HMAC (Hash-based Message Authentication Code) algorithms
for signing JSON Web Tokens (JWTs).
Each constant in this enum represents a different HMAC algorithm variant (HMAC256, HMAC384, HMAC512). The corresponding algorithm can be obtained by providing a secret key, which will be used to create a JWT signature.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionabstract com.auth0.jwt.algorithms.AlgorithmgetAlgorithm(String secretKey) Abstract method that must be implemented by each constant to return the correspondingAlgorithminstance using the provided secret key.static JwtAlgorithmReturns the enum constant of this class with the specified name.static JwtAlgorithm[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
HMAC256
HMAC256 algorithm for signing JWTs using a 256-bit key. -
HMAC384
HMAC384 algorithm for signing JWTs using a 384-bit key. -
HMAC512
HMAC512 algorithm for signing JWTs using a 512-bit key.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getAlgorithm
Abstract method that must be implemented by each constant to return the correspondingAlgorithminstance using the provided secret key.- Parameters:
secretKey- the secret key to be used for signing the JWT.- Returns:
- the
Algorithminstance corresponding to the selected HMAC variant.
-