Class Oauth
Oauth 1 authentication strategy for Cake\Http\Client
This object does not handle getting Oauth access tokens from the service provider. It only handles make client requests after you have obtained the Oauth tokens.
Generally not directly constructed, but instead used by {@link \Cake\Http\Client} when $options['auth']['type'] is 'oauth'
Method Summary
- 
          _buildAuth() protectedBuilds the Oauth Authorization header value. 
- 
          _encode() protectedURL Encodes a value based on rules of rfc3986 
- 
          _hmacSha1() protectedUse HMAC-SHA1 signing. 
- 
          _normalizeData() protectedRecursively convert request data into the normalized form. 
- 
          _normalizedParams() protectedSorts and normalizes request data and oauthValues 
- 
          _normalizedUrl() protectedBuilds a normalized URL 
- 
          _plaintext() protectedPlaintext signing 
- 
          _rsaSha1() protectedUse RSA-SHA1 signing. 
- 
          authentication() publicAdd headers for Oauth authorization. 
- 
          baseString() publicGenerate the Oauth basestring 
- 
          checkSslError() protectedCheck for SSL errors and raise if one is encountered. 
Method Detail
_buildAuth() ¶ protected
_buildAuth(array $data): stringBuilds the Oauth Authorization header value.
Parameters
- 
                array$data
- The oauth_* values to build 
Returns
string_encode() ¶ protected
_encode(string $value): stringURL Encodes a value based on rules of rfc3986
Parameters
- 
                string$value
- Value to encode. 
Returns
string_hmacSha1() ¶ protected
_hmacSha1(Cake\Http\Client\Request $request, array $credentials): stringUse HMAC-SHA1 signing.
This method is suitable for plain HTTP or HTTPS.
Parameters
- 
                Cake\Http\Client\Request$request
- The request object. 
- 
                array$credentials
- Authentication credentials. 
Returns
string_normalizeData() ¶ protected
_normalizeData(array $args, string $path = ''): arrayRecursively convert request data into the normalized form.
Parameters
- 
                array$args
- The arguments to normalize. 
- 
                string$path optional
- The current path being converted. 
Returns
arraySee Also
_normalizedParams() ¶ protected
_normalizedParams(Cake\Http\Client\Request $request, array $oauthValues): stringSorts and normalizes request data and oauthValues
Section 9.1.1 of Oauth spec.
- URL encode keys + values.
- Sort keys & values by byte value.
Parameters
- 
                Cake\Http\Client\Request$request
- The request object. 
- 
                array$oauthValues
- Oauth values. 
Returns
stringsorted and normalized values
_normalizedUrl() ¶ protected
_normalizedUrl(Psr\Http\Message\UriInterface $uri): stringBuilds a normalized URL
Section 9.1.2. of the Oauth spec
Parameters
- 
                Psr\Http\Message\UriInterface$uri
- Uri object to build a normalized version of. 
Returns
stringNormalized URL
_plaintext() ¶ protected
_plaintext(Cake\Http\Client\Request $request, array $credentials): stringPlaintext signing
This method is not suitable for plain HTTP. You should only ever use PLAINTEXT when dealing with SSL services.
Parameters
- 
                Cake\Http\Client\Request$request
- The request object. 
- 
                array$credentials
- Authentication credentials. 
Returns
stringAuthorization header.
_rsaSha1() ¶ protected
_rsaSha1(Cake\Http\Client\Request $request, array $credentials): stringUse RSA-SHA1 signing.
This method is suitable for plain HTTP or HTTPS.
Parameters
- 
                Cake\Http\Client\Request$request
- The request object. 
- 
                array$credentials
- Authentication credentials. 
Returns
stringThrows
RuntimeExceptionauthentication() ¶ public
authentication(Cake\Http\Client\Request $request, array $credentials): Cake\Http\Client\RequestAdd headers for Oauth authorization.
Parameters
- 
                Cake\Http\Client\Request$request
- The request object. 
- 
                array$credentials
- Authentication credentials. 
Returns
Cake\Http\Client\RequestThe updated request.
Throws
Cake\Core\Exception\CakeExceptionOn invalid signature types.
baseString() ¶ public
baseString(Cake\Http\Client\Request $request, array $oauthValues): stringGenerate the Oauth basestring
- Querystring, request data and oauth_* parameters are combined.
- Values are sorted by name and then value.
- Request values are concatenated and urlencoded.
- The request URL (without querystring) is normalized.
- The HTTP method, URL and request parameters are concatenated and returned.
Parameters
- 
                Cake\Http\Client\Request$request
- The request object. 
- 
                array$oauthValues
- Oauth values. 
Returns
stringcheckSslError() ¶ protected
checkSslError(): voidCheck for SSL errors and raise if one is encountered.
Returns
void