diff options
| author | Brent Shaffer <bshafs@gmail.com> | 2013-05-06 01:26:58 +0400 |
|---|---|---|
| committer | Brent Shaffer <bshafs@gmail.com> | 2013-05-06 01:26:58 +0400 |
| commit | 702bbf8495133fd4f92a0b7ccd7cc97bb22fa7a4 (patch) | |
| tree | 9b068680477c23b6808ab734b19cad2a7bc89591 /src | |
| parent | e4bf826975be6012ff9633ce307aa4cdd23b4a07 (diff) | |
| download | oauth2-server-php-702bbf8495133fd4f92a0b7ccd7cc97bb22fa7a4.tar.xz | |
cleans up ResponseInterface
Diffstat (limited to 'src')
| -rw-r--r-- | src/OAuth2/ClientAssertionType/HttpBasic.php | 1 | ||||
| -rw-r--r-- | src/OAuth2/Controller/AuthorizeController.php | 18 | ||||
| -rw-r--r-- | src/OAuth2/Response.php | 2 | ||||
| -rw-r--r-- | src/OAuth2/ResponseInterface.php | 2 |
4 files changed, 12 insertions, 11 deletions
diff --git a/src/OAuth2/ClientAssertionType/HttpBasic.php b/src/OAuth2/ClientAssertionType/HttpBasic.php index 0062c73..db376b0 100644 --- a/src/OAuth2/ClientAssertionType/HttpBasic.php +++ b/src/OAuth2/ClientAssertionType/HttpBasic.php @@ -85,6 +85,7 @@ class OAuth2_ClientAssertionType_HttpBasic implements OAuth2_ClientAssertionType if ($response) { $response->setError(400, 'invalid_client', 'Client credentials were not found in the headers or body'); } + return null; } }
\ No newline at end of file diff --git a/src/OAuth2/Controller/AuthorizeController.php b/src/OAuth2/Controller/AuthorizeController.php index b9f8bce..e3d032f 100644 --- a/src/OAuth2/Controller/AuthorizeController.php +++ b/src/OAuth2/Controller/AuthorizeController.php @@ -38,7 +38,7 @@ class OAuth2_Controller_AuthorizeController implements OAuth2_Controller_Authori } if ($is_authorized === false) { - $response->setRedirect(302, $params['redirect_uri'], 'access_denied', "The user denied access to your application", null, $params['state']); + $response->setRedirect(302, $params['redirect_uri'], $params['state'], 'access_denied', "The user denied access to your application"); return null; } @@ -104,16 +104,16 @@ class OAuth2_Controller_AuthorizeController implements OAuth2_Controller_Authori // type and client_id are required if (!$response_type || !in_array($response_type, array(self::RESPONSE_TYPE_AUTHORIZATION_CODE, self::RESPONSE_TYPE_ACCESS_TOKEN))) { - $response->setRedirect(302, $redirect_uri, 'invalid_request', 'Invalid or missing response type', null, $state); + $response->setRedirect(302, $redirect_uri, $state, 'invalid_request', 'Invalid or missing response type', null); return false; } if ($response_type == self::RESPONSE_TYPE_AUTHORIZATION_CODE) { if (!isset($this->responseTypes['code'])) { - $response->setRedirect(302, $redirect_uri, 'unsupported_response_type', 'authorization code grant type not supported', null, $state); + $response->setRedirect(302, $redirect_uri, $state, 'unsupported_response_type', 'authorization code grant type not supported', null); return false; } if (!$this->clientStorage->checkRestrictedGrantType($client_id, 'authorization_code')) { - $response->setRedirect(302, $redirect_uri, 'unauthorized_client', 'The grant type is unauthorized for this client_id', null, $state); + $response->setRedirect(302, $redirect_uri, $state, 'unauthorized_client', 'The grant type is unauthorized for this client_id', null); return false; } if ($this->responseTypes['code']->enforceRedirect() && !$redirect_uri) { @@ -124,29 +124,29 @@ class OAuth2_Controller_AuthorizeController implements OAuth2_Controller_Authori if ($response_type == self::RESPONSE_TYPE_ACCESS_TOKEN) { if (!$this->config['allow_implicit']) { - $response->setRedirect(302, $redirect_uri, 'unsupported_response_type', 'implicit grant type not supported', null, $state); + $response->setRedirect(302, $redirect_uri, $state, 'unsupported_response_type', 'implicit grant type not supported', null); return false; } if (!$this->clientStorage->checkRestrictedGrantType($client_id, 'implicit')) { - $response->setRedirect(302, $redirect_uri, 'unauthorized_client', 'The grant type is unauthorized for this client_id', null, $state); + $response->setRedirect(302, $redirect_uri, $state, 'unauthorized_client', 'The grant type is unauthorized for this client_id', null); return false; } } // Validate that the requested scope is supported if (false === $scope) { - $response->setRedirect(302, $redirect_uri, 'invalid_client', 'This application requires you specify a scope parameter', null, $state); + $response->setRedirect(302, $redirect_uri, $state, 'invalid_client', 'This application requires you specify a scope parameter', null); return false; } if (!is_null($scope) && !$this->scopeUtil->scopeExists($scope, $client_id)) { - $response->setRedirect(302, $redirect_uri, 'invalid_scope', 'An unsupported scope was requested', null, $state); + $response->setRedirect(302, $redirect_uri, $state, 'invalid_scope', 'An unsupported scope was requested', null); return false; } // Validate state parameter exists (if configured to enforce this) if ($this->config['enforce_state'] && !$state) { - $response->setRedirect(302, $redirect_uri, 'invalid_request', 'The state parameter is required'); + $response->setRedirect(302, $redirect_uri, null, 'invalid_request', 'The state parameter is required'); return false; } diff --git a/src/OAuth2/Response.php b/src/OAuth2/Response.php index 06b3e33..c31b692 100644 --- a/src/OAuth2/Response.php +++ b/src/OAuth2/Response.php @@ -232,7 +232,7 @@ class OAuth2_Response implements OAuth2_ResponseInterface } } - public function setRedirect($statusCode = 302, $url, $error = null, $errorDescription = null, $errorUri = null, $state = null) + public function setRedirect($statusCode = 302, $url, $state = null, $error = null, $errorDescription = null, $errorUri = null) { if (empty($url)) { throw new InvalidArgumentException('Cannot redirect to an empty URL.'); diff --git a/src/OAuth2/ResponseInterface.php b/src/OAuth2/ResponseInterface.php index ac59763..e2320c3 100644 --- a/src/OAuth2/ResponseInterface.php +++ b/src/OAuth2/ResponseInterface.php @@ -9,5 +9,5 @@ interface OAuth2_ResponseInterface public function addHttpHeaders(array $httpHeaders); public function setStatusCode($statusCode); public function setError($statusCode, $name, $description = null, $uri = null); - public function setRedirect($statusCode = 302, $url, $error = null, $errorDescription = null, $errorUri = null, $state = null); + public function setRedirect($statusCode = 302, $url, $state = null, $error = null, $errorDescription = null, $errorUri = null); }
\ No newline at end of file |
