Package io.hanko.sdk.util
Class HmacUtil
java.lang.Object
io.hanko.sdk.util.HmacUtil
Utility class for providing an authorization header to use for
making authenticated calls to the Hanko API.
- See Also:
- Hanko API security
-
Method Summary
-
Method Details
-
makeAuthorizationHeader
public static String makeAuthorizationHeader(String apiSecret, String apiKeyId, String method, String path, String content)Construct a suitable authorization header for a request to the Hanko API.If no
apiKeyId
is given, the header value consists of the `secret` prefix and the apiSecret as a token value. Otherwise the header value consist of the `hanko` prefix, and a base64 encoded JSON representation including an HMAC signature as the token value.- Parameters:
apiSecret
- the Hanko API key as a StringapiKeyId
- the Hanko API key ID as a Stringmethod
- the HTTP method name used in the requestpath
- the endpoint path for the request as a Stringcontent
- the request body content (if any)- Returns:
- the complete authorization header as a String
- Throws:
HankoClientException
- if the HMAC could not be calculated
-