Class Mage_Oauth_Model_Server
oAuth Server
Package: Mage\Oauth
Category: Mage
Copyright: Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
License: Open Software License (OSL 3.0)
Author: Magento Core Team <core@magentocommerce.com>
Located at code/core/Mage/Oauth/Model/Server.php
Category: Mage
Copyright: Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
License: Open Software License (OSL 3.0)
Author: Magento Core Team <core@magentocommerce.com>
Located at code/core/Mage/Oauth/Model/Server.php
public
|
#
__construct( Zend_Controller_Request_Http $request = null )
Internal constructor not depended on params |
protected
|
|
protected
|
|
protected
Zend_Controller_Response_Http
|
|
protected
|
|
protected
|
|
protected
boolean
|
|
protected
|
#
_processRequest( string $requestType )
Extract parameters from sources (GET, FormBody, Authorization header), decode them and validate |
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
public
|
|
public
|
#
authorizeToken( integer $userId, string $userType )
Validate request, authorize token and return it |
public
|
|
public
|
|
public static
array
|
|
public
|
|
public
string
|
#
reportProblem(
Create response string for problem during request and set HTTP error code |
public
|
integer |
ERR_OK
|
0 |
#
OAuth result statuses |
integer |
ERR_VERSION_REJECTED
|
1 |
|
integer |
ERR_PARAMETER_ABSENT
|
2 |
|
integer |
ERR_PARAMETER_REJECTED
|
3 |
|
integer |
ERR_TIMESTAMP_REFUSED
|
4 |
|
integer |
ERR_NONCE_USED
|
5 |
|
integer |
ERR_SIGNATURE_METHOD_REJECTED
|
6 |
|
integer |
ERR_SIGNATURE_INVALID
|
7 |
|
integer |
ERR_CONSUMER_KEY_REJECTED
|
8 |
|
integer |
ERR_TOKEN_USED
|
9 |
|
integer |
ERR_TOKEN_EXPIRED
|
10 |
|
integer |
ERR_TOKEN_REVOKED
|
11 |
|
integer |
ERR_TOKEN_REJECTED
|
12 |
|
integer |
ERR_VERIFIER_INVALID
|
13 |
|
integer |
ERR_PERMISSION_UNKNOWN
|
14 |
|
integer |
ERR_PERMISSION_DENIED
|
15 |
|
string |
SIGNATURE_HMAC
|
'HMAC-SHA1' |
#
Signature Methods |
string |
SIGNATURE_RSA
|
'RSA-SHA1' |
|
string |
SIGNATURE_PLAIN
|
'PLAINTEXT' |
|
string |
REQUEST_INITIATE
|
'initiate' |
#
Request Types |
string |
REQUEST_AUTHORIZE
|
'authorize' |
|
string |
REQUEST_TOKEN
|
'token' |
|
string |
REQUEST_RESOURCE
|
'resource' |
|
integer |
HTTP_OK
|
200 |
#
HTTP Response Codes |
integer |
HTTP_BAD_REQUEST
|
400 |
|
integer |
HTTP_UNAUTHORIZED
|
401 |
|
integer |
HTTP_INTERNAL_ERROR
|
500 |
|
integer |
TIME_DEVIATION
|
600 |
#
Possible time deviation for timestamp validation in sec. |
string |
CALLBACK_ESTABLISHED
|
'oob' |
#
Value of callback URL when it is established or if cliaent is unable to receive callbacks |
protected
|
$_consumer |
|
#
Consumer object |
protected
array
|
$_errors | array(
self::ERR_VERSION_REJECTED => 'version_rejected',
self::ERR_PARAMETER_ABSENT => 'parameter_absent',
self::ERR_PARAMETER_REJECTED => 'parameter_rejected',
self::ERR_TIMESTAMP_REFUSED => 'timestamp_refused',
self::ERR_NONCE_USED => 'nonce_used',
self::ERR_SIGNATURE_METHOD_REJECTED => 'signature_method_rejected',
self::ERR_SIGNATURE_INVALID => 'signature_invalid',
self::ERR_CONSUMER_KEY_REJECTED => 'consumer_key_rejected',
self::ERR_TOKEN_USED => 'token_used',
self::ERR_TOKEN_EXPIRED => 'token_expired',
self::ERR_TOKEN_REVOKED => 'token_revoked',
self::ERR_TOKEN_REJECTED => 'token_rejected',
self::ERR_VERIFIER_INVALID => 'verifier_invalid',
self::ERR_PERMISSION_UNKNOWN => 'permission_unknown',
self::ERR_PERMISSION_DENIED => 'permission_denied'
) |
#
Error code to error messages pairs |
protected
array
|
$_errorsToHttpCode | array(
self::ERR_VERSION_REJECTED => self::HTTP_BAD_REQUEST,
self::ERR_PARAMETER_ABSENT => self::HTTP_BAD_REQUEST,
self::ERR_PARAMETER_REJECTED => self::HTTP_BAD_REQUEST,
self::ERR_TIMESTAMP_REFUSED => self::HTTP_BAD_REQUEST,
self::ERR_NONCE_USED => self::HTTP_UNAUTHORIZED,
self::ERR_SIGNATURE_METHOD_REJECTED => self::HTTP_BAD_REQUEST,
self::ERR_SIGNATURE_INVALID => self::HTTP_UNAUTHORIZED,
self::ERR_CONSUMER_KEY_REJECTED => self::HTTP_UNAUTHORIZED,
self::ERR_TOKEN_USED => self::HTTP_UNAUTHORIZED,
self::ERR_TOKEN_EXPIRED => self::HTTP_UNAUTHORIZED,
self::ERR_TOKEN_REVOKED => self::HTTP_UNAUTHORIZED,
self::ERR_TOKEN_REJECTED => self::HTTP_UNAUTHORIZED,
self::ERR_VERIFIER_INVALID => self::HTTP_UNAUTHORIZED,
self::ERR_PERMISSION_UNKNOWN => self::HTTP_UNAUTHORIZED,
self::ERR_PERMISSION_DENIED => self::HTTP_UNAUTHORIZED
) |
#
Error code to HTTP error code |
protected
array
|
$_params | array() |
#
Request parameters |
protected
array
|
$_protocolParams | array() |
#
Protocol parameters |
protected
|
$_request |
|
#
Request object |
protected
string
|
$_requestType |
|
#
Request type: initiate, permanent token request or authorized one |
protected
Zend_Controller_Response_Http
|
$_response | null |
#
Response object |
protected
|
$_token |
|
#
Token object |