SignerV4
in package
implements
Signer
Version4 of signer.
Tags
Table of Contents
Interfaces
- Signer
- Interface for signing a request.
Constants
- ALGORITHM_REQUEST = 'AWS4-HMAC-SHA256'
- BLACKLIST_HEADERS = ['cache-control' => true, 'content-type' => true, 'content-length' => true, 'expect' => true, 'max-forwards' => true, 'pragma' => true, 'range' => true, 'te' => true, 'if-match' => true, 'if-none-match' => true, 'if-modified-since' => true, 'if-unmodified-since' => true, 'if-range' => true, 'accept' => true, 'authorization' => true, 'proxy-authorization' => true, 'from' => true, 'referer' => true, 'user-agent' => true, 'x-amzn-trace-id' => true, 'aws-sdk-invocation-id' => true, 'aws-sdk-retry' => true]
Properties
- $region : string
- $scopeName : string
Methods
- __construct() : mixed
- presign() : void
- sign() : void
- buildBodyDigest() : string
- buildCanonicalPath() : string
- convertBodyToStream() : void
- assignAmzQueryValues() : void
- buildCanonicalHeaders() : array<string, string>
- buildCanonicalQuery() : string
- buildCanonicalRequest() : string
- buildCredentialString() : array<string|int, string>
- buildSignature() : string
- buildSigningKey() : string
- buildStringToSign() : string
- buildTime() : void
- convertBodyToQuery() : void
- convertHeaderToQuery() : void
- handleSignature() : void
- removePresign() : void
- sanitizeHostForHeader() : void
Constants
ALGORITHM_REQUEST
private
mixed
ALGORITHM_REQUEST
= 'AWS4-HMAC-SHA256'
BLACKLIST_HEADERS
private
mixed
BLACKLIST_HEADERS
= ['cache-control' => true, 'content-type' => true, 'content-length' => true, 'expect' => true, 'max-forwards' => true, 'pragma' => true, 'range' => true, 'te' => true, 'if-match' => true, 'if-none-match' => true, 'if-modified-since' => true, 'if-unmodified-since' => true, 'if-range' => true, 'accept' => true, 'authorization' => true, 'proxy-authorization' => true, 'from' => true, 'referer' => true, 'user-agent' => true, 'x-amzn-trace-id' => true, 'aws-sdk-invocation-id' => true, 'aws-sdk-retry' => true]
Properties
$region
private
string
$region
$scopeName
private
string
$scopeName
Methods
__construct()
public
__construct(string $scopeName, string $region) : mixed
Parameters
- $scopeName : string
- $region : string
presign()
public
presign(Request $request, Credentials $credentials, RequestContext $context) : void
Parameters
- $request : Request
- $credentials : Credentials
- $context : RequestContext
sign()
public
sign(Request $request, Credentials $credentials, RequestContext $context) : void
Parameters
- $request : Request
- $credentials : Credentials
- $context : RequestContext
buildBodyDigest()
protected
buildBodyDigest(Request $request, bool $isPresign) : string
Parameters
- $request : Request
- $isPresign : bool
Return values
stringbuildCanonicalPath()
protected
buildCanonicalPath(Request $request) : string
Parameters
- $request : Request
Return values
stringconvertBodyToStream()
protected
convertBodyToStream(SigningContext $context) : void
Parameters
- $context : SigningContext
assignAmzQueryValues()
private
assignAmzQueryValues(Request $request, Credentials $credentials, bool $isPresign) : void
Parameters
- $request : Request
- $credentials : Credentials
- $isPresign : bool
buildCanonicalHeaders()
private
buildCanonicalHeaders(Request $request, bool $isPresign) : array<string, string>
Parameters
- $request : Request
- $isPresign : bool
Return values
array<string, string>buildCanonicalQuery()
private
buildCanonicalQuery(Request $request) : string
Parameters
- $request : Request
Return values
stringbuildCanonicalRequest()
private
buildCanonicalRequest(Request $request, array<string, string> $canonicalHeaders, string $bodyDigest) : string
Parameters
- $request : Request
- $canonicalHeaders : array<string, string>
- $bodyDigest : string
Return values
stringbuildCredentialString()
private
buildCredentialString(Request $request, Credentials $credentials, DateTimeImmutable $now, bool $isPresign) : array<string|int, string>
Parameters
- $request : Request
- $credentials : Credentials
- $now : DateTimeImmutable
- $isPresign : bool
Return values
array<string|int, string>buildSignature()
private
buildSignature(string $stringToSign, string $signingKey) : string
Parameters
- $stringToSign : string
- $signingKey : string
Return values
stringbuildSigningKey()
private
buildSigningKey(Credentials $credentials, array<string|int, string> $credentialScope) : string
Parameters
- $credentials : Credentials
- $credentialScope : array<string|int, string>
Return values
stringbuildStringToSign()
private
buildStringToSign(DateTimeImmutable $now, string $credentialString, string $canonicalRequest) : string
Parameters
- $now : DateTimeImmutable
- $credentialString : string
- $canonicalRequest : string
Return values
stringbuildTime()
private
buildTime(Request $request, DateTimeImmutable $now, DateTimeImmutable $expires, bool $isPresign) : void
Parameters
- $request : Request
- $now : DateTimeImmutable
- $expires : DateTimeImmutable
- $isPresign : bool
convertBodyToQuery()
private
convertBodyToQuery(Request $request) : void
Parameters
- $request : Request
convertHeaderToQuery()
private
convertHeaderToQuery(Request $request) : void
Parameters
- $request : Request
handleSignature()
private
handleSignature(Request $request, Credentials $credentials, DateTimeImmutable $now, DateTimeImmutable $expires, bool $isPresign) : void
Parameters
- $request : Request
- $credentials : Credentials
- $now : DateTimeImmutable
- $expires : DateTimeImmutable
- $isPresign : bool
removePresign()
private
removePresign(Request $request) : void
Parameters
- $request : Request
sanitizeHostForHeader()
private
sanitizeHostForHeader(Request $request) : void
Parameters
- $request : Request