This contains the main code that is used for signing a request
Class is immutable. @Immutable
| Modifier and Type | Class and Description |
|---|---|
| public static class | RequestSignerImpl.
Basic configuration of what headers to sign. |
| Modifier and Type | Field and Description |
|---|---|
| private final Supplier | |
| private final KeySupplier | |
| private static final Logger | |
| private static final SignatureSigner | |
| private final RequestSignerImpl. |
| Access | Constructor and Description |
|---|---|
| public | RequestSignerImpl(final KeySupplier<RSAPrivateKey>
A key supplier that will be used for signing the request keySupplier, final SigningStrategy The signing strategy to determine what headers to use signingStrategy, final Supplier<String> A keyId supplier that will be used for signing the request keyIdSupplier)Construct the RequestSigner with the specified KeySupplier. |
| public | RequestSignerImpl(final KeySupplier<RSAPrivateKey>
A key supplier that will be used for signing the request keySupplier, final RequestSignerImpl.The signing configuration to determine what headers to use signingConfiguration,A keyId supplier that will be used for signing the request keyIdSupplier)Construct the RequestSigner with the specified KeySupplier. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static String | |
| private static String | |
| private static String | |
| pack-priv static Map | calculateMissingHeaders(final String httpMethod, final URI uri, final Map<String, List<String>> existingHeaders, final Object body, final List<String> requiredHeaders, final RequestSignerImpl.
|
| pack-priv static String | |
| private static SimpleDateFormat | |
| private static String | |
| private static List | |
| private static List | getOptionalSigningHeaders(final String httpMethod, final RequestSignerImpl.
|
| private static RSAPrivateKey | |
| private static List | getRequiredSigningHeaders(final String httpMethod, final RequestSignerImpl.
|
| pack-priv static Map | |
| private static boolean | |
| private static byte[] | |
| private static String | |
| public Map | signRequest(final URI
the request uri uri, final String the request method httpMethod, final Map<String, List<String>> the request headers headers, final Object the request body (if this is a PUT or POST method) body)Implements com. Sign a request. |
| private Map | |
| public static Map | signRequest(final Algorithm algorithm, final URI uri, final String httpMethod, final Map<String, List<String>> headers, final Object body, final String versionName, final String keyId, final KeySupplier<RSAPrivateKey> keySupplier, final RequestSignerImpl.
|
| private static RequestSignerImpl. | |
| private static String | |
| private static Version |
| keyIdSupplier | back to summary |
|---|---|
| private final Supplier<String> keyIdSupplier | |
| keySupplier | back to summary |
|---|---|
| private final KeySupplier<RSAPrivateKey> keySupplier | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| SIGNER | back to summary |
|---|---|
| private static final SignatureSigner SIGNER | |
| signingConfiguration | back to summary |
|---|---|
| private final RequestSignerImpl. | |
| RequestSignerImpl | back to summary |
|---|---|
| public RequestSignerImpl(final KeySupplier<RSAPrivateKey> keySupplier, final SigningStrategy signingStrategy, final Supplier<String> keyIdSupplier) Construct the RequestSigner with the specified KeySupplier. This will be used to get keys for doing the signing.
| |
| RequestSignerImpl | back to summary |
|---|---|
| public RequestSignerImpl(final KeySupplier<RSAPrivateKey> keySupplier, final RequestSignerImpl. Construct the RequestSigner with the specified KeySupplier. This will be used to get keys for doing the signing.
| |
| base64Encode | back to summary |
|---|---|
| pack-priv static String base64Encode(byte[] bytes) | |
| calculateAuthorizationHeader | back to summary |
|---|---|
| private static String calculateAuthorizationHeader(final String keyId, final String httpMethod, final String signature, final Algorithm algorithm, final String version, final List<String> requiredHeaders, final List<String> optionalHeaders) | |
| calculateBodySHA256 | back to summary |
|---|---|
| private static String calculateBodySHA256(final byte[] body) | |
| calculateMissingHeaders | back to summary |
|---|---|
| pack-priv static Map | |
| calculateStringToSign | back to summary |
|---|---|
pack-priv static String calculateStringToSign(String httpMethod, String path, Map<String, List<String>> allHeaders, List<String> requiredHeaders, Map<String, List<String>> originalHeaders)
| |
| createFormatter | back to summary |
|---|---|
| private static SimpleDateFormat createFormatter() | |
| extractPath | back to summary |
|---|---|
| private static String extractPath(URI uri) | |
| getIgnoreCaseHeaders | back to summary |
|---|---|
| private static List | |
| getOptionalSigningHeaders | back to summary |
|---|---|
| private static List | |
| getPrivateKey | back to summary |
|---|---|
| private static RSAPrivateKey getPrivateKey(String keyId, KeySupplier<RSAPrivateKey> keySupplier) | |
| getRequiredSigningHeaders | back to summary |
|---|---|
| private static List | |
| ignoreCaseHeaders | back to summary |
|---|---|
pack-priv static Map
| |
| isRequiredHeaderMissing | back to summary |
|---|---|
| private static boolean isRequiredHeaderMissing(String headerName, List<String> requiredHeaders, Map<String, ?> existingHeaders) | |
| readBodyBytes | back to summary |
|---|---|
| private static byte[] readBodyBytes(Object body) throws IOException | |
| sign | back to summary |
|---|---|
| private static String sign(RSAPrivateKey key, Algorithm algorithm, String stringToSign) | |
| signRequest | back to summary |
|---|---|
| public Map Implements com. Doc from com. Sign a request. | |
| signRequest | back to summary |
|---|---|
| private Map | |
| signRequest | back to summary |
|---|---|
| public static Map | |
| toSigningConfiguration | back to summary |
|---|---|
| private static RequestSignerImpl. | |
| transformHeadersToJsonString | back to summary |
|---|---|
| private static String transformHeadersToJsonString(final Map<String, List<String>> headers) | |
| validateVersion | back to summary |
|---|---|
| private static Version validateVersion(String version, Algorithm algorithm) | |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | headersToSign
Map of HTTP method to list of headers to sign. |
| private final Map | optionalHeadersToSign
Map of HTTP method to list of headers to sign, if they are present. |
| private final boolean | skipContentHeadersForStreamingPutRequests
Flag indicating whether InputStreams in PUT requests are allowed to skip content headers. |
| Access | Constructor and Description |
|---|---|
| public |
| headersToSign | back to summary |
|---|---|
| private final Map<String, List<String>> headersToSign Map of HTTP method to list of headers to sign. | |
| optionalHeadersToSign | back to summary |
|---|---|
| private final Map<String, List<String>> optionalHeadersToSign Map of HTTP method to list of headers to sign, if they are present. | |
| skipContentHeadersForStreamingPutRequests | back to summary |
|---|---|
| private final boolean skipContentHeadersForStreamingPutRequests Flag indicating whether InputStreams in PUT requests are allowed to skip content headers. | |