Class SaslRoleTokenSigner
java.lang.Object
org.apache.pulsar.broker.authentication.SaslRoleTokenSigner
-
Constructor Summary
ConstructorsConstructorDescriptionSaslRoleTokenSigner(byte[] secret) Creates a SaslRoleTokenSigner instance using the specified secret. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcomputeSignature(String str) Returns the signature of a string.Returns a signed string.verifyAndExtract(String signedStr) Verifies a signed string and extracts the original string.
-
Constructor Details
-
SaslRoleTokenSigner
public SaslRoleTokenSigner(byte[] secret) Creates a SaslRoleTokenSigner instance using the specified secret.- Parameters:
secret- secret to use for creating the digest.
-
-
Method Details
-
sign
Returns a signed string. The signature '&s=SIGNATURE' is appended at the end of the string.- Parameters:
str- string to sign.- Returns:
- the signed string.
-
verifyAndExtract
Verifies a signed string and extracts the original string.- Parameters:
signedStr- the signed string to verify and extract.- Returns:
- the extracted original string.
- Throws:
AuthenticationException- thrown if the given string is not a signed string or if the signature is invalid.
-
computeSignature
Returns the signature of a string.- Parameters:
str- string to sign.- Returns:
- the signature for the string.
-