Oauth (class)
Class Oauth
Oauth 1 authentication strategy for Cake\Network\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 Cake\Network\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.
- _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
Method Detail
_buildAuth()source protected
_buildAuth( array $data )
Builds the Oauth Authorization header value.
Parameters
- array
$data
- The oauth_* values to build
Returns
string_encode()source protected
_encode( string $value )
URL Encodes a value based on rules of rfc3986
Parameters
- string
$value
- Value to encode.
Returns
string_hmacSha1()source protected
_hmacSha1( Cake\Network\Http\Request $request , array $credentials )
Use HMAC-SHA1 signing.
This method is suitable for plain HTTP or HTTPS.
Parameters
-
Cake\Network\Http\Request
$request
- The request object.
- array
$credentials
- Authentication credentials.
Returns
string_normalizedParams()source protected
_normalizedParams( Cake\Network\Http\Request $request , array $oauthValues )
Sorts 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\Network\Http\Request
$request
- The request object.
- array
$oauthValues
- Oauth values.
Returns
stringsorted and normalized values
_normalizedUrl()source protected
_normalizedUrl( string $url )
Builds a normalized URL
Section 9.1.2. of the Oauth spec
Parameters
- string
$url
- URL
Returns
stringNormalized URL
Throws
Cake\Core\Exception\Exception
On invalid URLs
_plaintext()source protected
_plaintext( Cake\Network\Http\Request $request , array $credentials )
Plaintext signing
This method is not suitable for plain HTTP. You should only ever use PLAINTEXT when dealing with SSL services.
Parameters
-
Cake\Network\Http\Request
$request
- The request object.
- array
$credentials
- Authentication credentials.
Returns
stringAuthorization header.
_rsaSha1()source protected
_rsaSha1( Cake\Network\Http\Request $request , array $credentials )
Use RSA-SHA1 signing.
This method is suitable for plain HTTP or HTTPS.
Parameters
-
Cake\Network\Http\Request
$request
- The request object.
- array
$credentials
- Authentication credentials.
Returns
stringThrows
RuntimeExceptionauthentication()source public
authentication( Cake\Network\Http\Request $request , array $credentials )
Add headers for Oauth authorization.
Parameters
-
Cake\Network\Http\Request
$request
- The request object.
- array
$credentials
- Authentication credentials.
Throws
Cake\Core\Exception\Exception
On invalid signature types.
baseString()source public
baseString( Cake\Network\Http\Request $request , array $oauthValues )
Generate 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\Network\Http\Request
$request
- The request object.
- array
$oauthValues
- Oauth values.
Returns
string
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/3.2/class-Cake.Network.Http.Auth.Oauth.html