Class V4CanonicalRequest
- java.lang.Object
-
- software.amazon.awssdk.http.auth.aws.internal.signer.V4CanonicalRequest
-
@Immutable public final class V4CanonicalRequest extends Object
A class that represents a canonical request in AWS, as documented:https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html#create-canonical-request
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classV4CanonicalRequest.OptionsA class for representing options used when creating aV4CanonicalRequest
-
Constructor Summary
Constructors Constructor Description V4CanonicalRequest(SdkHttpRequest request, String contentHash, V4CanonicalRequest.Options options)Create a canonical request.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<Pair<String,List<String>>>getCanonicalHeaders(Map<String,List<String>> headers)Get the list of headers that are to be signed.static List<Pair<String,List<String>>>getCanonicalHeaders(SdkHttpRequest request)Get the list of headers that are to be signed.static StringgetCanonicalHeadersString(List<Pair<String,List<String>>> canonicalHeaders)Get the string representing the headers that will be signed and their values.StringgetCanonicalRequestString()Get the canonical request string.StringgetSignedHeadersString()Get the string representing which headers are part of the signing process.static StringgetSignedHeadersString(List<Pair<String,List<String>>> canonicalHeaders)Get the string representing which headers are part of the signing process.
-
-
-
Constructor Detail
-
V4CanonicalRequest
public V4CanonicalRequest(SdkHttpRequest request, String contentHash, V4CanonicalRequest.Options options)
Create a canonical request.Each parameter of a canonical request is set upon creation of this object.
To get such a parameter (i.e. the canonical request string), simply call the getter for that parameter (i.e. getCanonicalRequestString())
-
-
Method Detail
-
getSignedHeadersString
public String getSignedHeadersString()
Get the string representing which headers are part of the signing process. Header names are separated by a semicolon.
-
getCanonicalRequestString
public String getCanonicalRequestString()
Get the canonical request string.
-
getCanonicalHeaders
public static List<Pair<String,List<String>>> getCanonicalHeaders(SdkHttpRequest request)
Get the list of headers that are to be signed.If calling from a site with the request object handy, this method should be used instead of passing the headers themselves, as doing so creates a redundant copy.
-
getCanonicalHeaders
public static List<Pair<String,List<String>>> getCanonicalHeaders(Map<String,List<String>> headers)
Get the list of headers that are to be signed. The supplied map of headers is expected to be sorted case-insensitively.
-
getCanonicalHeadersString
public static String getCanonicalHeadersString(List<Pair<String,List<String>>> canonicalHeaders)
Get the string representing the headers that will be signed and their values. The input list is expected to be sorted case-insensitively.The output string will have header names as lower-case, sorted in alphabetical order, and followed by a colon.
Values are trimmed of any leading/trailing spaces, sequential spaces are converted to single space, and multiple values are comma separated.
Each header-value pair is separated by a newline.
-
-