Enum Class SignatureAlgorithm
- All Implemented Interfaces:
Serializable,Comparable<SignatureAlgorithm>,Constable
Enumeration of supported webhook signature algorithms.
- Since:
- 1.45.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSystem property to override default signature algorithm. -
Method Summary
Modifier and TypeMethodDescriptionstatic SignatureAlgorithmGets the default algorithm for new configurations.static SignatureAlgorithmReturns the enum constant of this class with the specified name.static SignatureAlgorithm[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SHA256
SHA-256 HMAC signature validation (recommended). Uses X-Hub-Signature-256 header with sha256= prefix. -
SHA1
Deprecated.Use SHA256 for enhanced securitySHA-1 HMAC signature validation (legacy). Uses X-Hub-Signature header with sha1= prefix.
-
-
Field Details
-
DEFAULT_ALGORITHM_PROPERTY
System property to override default signature algorithm. Set to "SHA1" to use legacy SHA-1 as default for backwards compatibility.- See Also:
-
-
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
-
getDefault
Gets the default algorithm for new configurations. Defaults to SHA-256 for security, but can be overridden via system property. This is evaluated dynamically to respect system property changes.- Returns:
- the default algorithm based on current system property
-
getPrefix
- Returns:
- the prefix used in signature strings (e.g. "sha256", "sha1")
-
getHeaderName
- Returns:
- the HTTP header name for this algorithm
-
getJavaAlgorithm
- Returns:
- the Java algorithm name for HMAC computation
-
getSignaturePrefix
- Returns:
- the expected signature prefix including equals sign (e.g. "sha256=", "sha1=")
-