Package: v4
Constants
-
const EmptyStringSHA256 = readonly
EmptyStringSHA256 is the hex encoded sha256 value of an empty string
-
Value:
`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` -
const UnsignedPayload = readonly
UnsignedPayload indicates that the request payload body is unsigned
-
Value:
"UNSIGNED-PAYLOAD" -
const AmzAlgorithmKey = readonly
AmzAlgorithmKey indicates the signing algorithm
-
Value:
"X-Amz-Algorithm" -
const AmzSecurityTokenKey = readonly
AmzSecurityTokenKey indicates the security token to be used with temporary credentials
-
Value:
"X-Amz-Security-Token" -
const AmzDateKey = readonly
AmzDateKey is the UTC timestamp for the request in the format YYYYMMDD’T’HHMMSS’Z’
-
Value:
"X-Amz-Date" -
const AmzCredentialKey = readonly
AmzCredentialKey is the access key ID and credential scope
-
Value:
"X-Amz-Credential" -
const AmzSignedHeadersKey = readonly
AmzSignedHeadersKey is the set of headers signed for the request
-
Value:
"X-Amz-SignedHeaders" -
const AmzSignatureKey = readonly
AmzSignatureKey is the query parameter to store the SigV4 signature
-
Value:
"X-Amz-Signature" -
const TimeFormat = readonly
TimeFormat is the time format to be used in the X-Amz-Date header or query parameter
-
Value:
"20060102T150405Z" -
const ShortTimeFormat = readonly
ShortTimeFormat is the shorten time format used in the credential scope
-
Value:
"20060102" -
const ContentSHAKey = readonly
ContentSHAKey is the SHA256 of request body
-
Value:
"X-Amz-Content-Sha256" -
const StreamingEventsPayload = readonly
StreamingEventsPayload indicates that the request payload body is a signed event stream.
-
Value:
"STREAMING-AWS4-HMAC-SHA256-EVENTS"
Variables
-
var IgnoredHeaders = writable
IgnoredHeaders is a list of headers that are ignored during signing
-
Value:
Rules{ ExcludeList{ MapRule{ "Authorization": struct{}{}, "User-Agent": struct{}{}, "X-Amzn-Trace-Id": struct{}{}, "Expect": struct{}{}, "Transfer-Encoding": struct{}{}, }, }, } -
var RequiredSignedHeaders = writable
RequiredSignedHeaders is a allow list for Build canonical headers.
-
Value:
Rules{ AllowList{ MapRule{ "Cache-Control": struct{}{}, "Content-Disposition": struct{}{}, "Content-Encoding": struct{}{}, "Content-Language": struct{}{}, "Content-Md5": struct{}{}, "Content-Type": struct{}{}, "Expires": struct{}{}, "If-Match": struct{}{}, "If-Modified-Since": struct{}{}, "If-None-Match": struct{}{}, "If-Unmodified-Since": struct{}{}, "Range": struct{}{}, "X-Amz-Acl": struct{}{}, "X-Amz-Copy-Source": struct{}{}, "X-Amz-Copy-Source-If-Match": struct{}{}, "X-Amz-Copy-Source-If-Modified-Since": struct{}{}, "X-Amz-Copy-Source-If-None-Match": struct{}{}, "X-Amz-Copy-Source-If-Unmodified-Since": struct{}{}, "X-Amz-Copy-Source-Range": struct{}{}, "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm": struct{}{}, "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key": struct{}{}, "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, "X-Amz-Grant-Full-control": struct{}{}, "X-Amz-Grant-Read": struct{}{}, "X-Amz-Grant-Read-Acp": struct{}{}, "X-Amz-Grant-Write": struct{}{}, "X-Amz-Grant-Write-Acp": struct{}{}, "X-Amz-Metadata-Directive": struct{}{}, "X-Amz-Mfa": struct{}{}, "X-Amz-Server-Side-Encryption": struct{}{}, "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id": struct{}{}, "X-Amz-Server-Side-Encryption-Context": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Algorithm": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, "X-Amz-Storage-Class": struct{}{}, "X-Amz-Website-Redirect-Location": struct{}{}, "X-Amz-Content-Sha256": struct{}{}, "X-Amz-Tagging": struct{}{}, }, }, Patterns{"X-Amz-Object-Lock-"}, Patterns{"X-Amz-Meta-"}, } -
var AllowedQueryHoisting = writable
AllowedQueryHoisting is a allowed list for Build query headers. The boolean value represents whether or not it is a pattern.
-
Value:
Type Summary collapse
-
AllowList
struct
AllowList is a generic Rule for include listing.
-
ExcludeList
struct
ExcludeList is a generic Rule for exclude listing.
-
InclusiveRules
struct
IsValid will return true if all rules are true.
-
MapRule
struct
IsValid for the map Rule satisfies whether it exists in the map.
-
Patterns
struct
IsValid for Patterns checks each pattern and returns if a match has been found.
-
Rules
struct
IsValid will iterate through all rules and see if any rules apply to the value and supports nested rules.
-
SigningKeyDeriver
struct
SigningKeyDeriver derives a signing key from a set of credentials.
-
SigningTime
struct
SigningTime provides a wrapper around a time.Time which provides cached values for SigV4 signing.
Interface Summary collapse
-
Rule
interface
Rule interface allows for more flexible rules and just simply checks whether or not a value adheres to that Rule.
Function Summary collapse
-
func BuildCredentialScope(signingTime SigningTime, region, service string) string
BuildCredentialScope builds the Signature Version 4 (SigV4) signing scope.
-
func GetURIPath(u *url.URL) string
GetURIPath returns the escaped URI component from the provided URL.
-
func HMACSHA256(key []byte, data []byte) []byte
HMACSHA256 computes a HMAC-SHA256 of data given the provided key.
-
func NewSigningTime(t time.Time) SigningTime
NewSigningTime creates a new SigningTime given a time.Time.
-
func SanitizeHostForHeader(r *http.Request)
SanitizeHostForHeader removes default port from host and updates request.Host.
-
func StripExcessSpaces(str string) string
StripExcessSpaces will rewrite the passed in slice’s string values to not contain multiple side-by-side spaces.
Function Details
func BuildCredentialScope(signingTime SigningTime, region, service string) string
BuildCredentialScope builds the Signature Version 4 (SigV4) signing scope
5 6 7 8 9 10 11 12 |
// File 'aws/signer/internal/v4/scope.go', line 5
|
func GetURIPath(u *url.URL) string
GetURIPath returns the escaped URI component from the provided URL.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
// File 'aws/signer/internal/v4/util.go', line 49
|
func HMACSHA256(key []byte, data []byte) []byte
HMACSHA256 computes a HMAC-SHA256 of data given the provided key.
8 9 10 11 12 |
// File 'aws/signer/internal/v4/hmac.go', line 8
|
func NewSigningTime(t time.Time) SigningTime
NewSigningTime creates a new SigningTime given a time.Time
12 13 14 15 16 |
// File 'aws/signer/internal/v4/time.go', line 12
|
func SanitizeHostForHeader(r *http.Request)
SanitizeHostForHeader removes default port from host and updates request.Host
8 9 10 11 12 13 14 |
// File 'aws/signer/internal/v4/host.go', line 8
|
func StripExcessSpaces(str string) string
StripExcessSpaces will rewrite the passed in slice’s string values to not contain multiple side-by-side spaces.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
// File 'aws/signer/internal/v4/util.go', line 11
|