/** * @param $redirect_uri * An absolute URI to which the authorization server will redirect the * user-agent to when the end-user authorization step is completed. * @param $error * A single error code as described in Section 4.1.2.1 * @param $error_description * (optional) A human-readable text providing additional information, * used to assist in the understanding and resolution of the error * occurred. * @param $state * (optional) REQUIRED if the "state" parameter was present in the client * authorization request. Set to the exact value received from the client. * * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-4.1.2.1 * * @ingroup oauth2_error */ public function __construct($redirect_uri, $error, $error_description = NULL, $state = NULL) { parent::__construct(Server::HTTP_FOUND, $error, $error_description); $this->redirectUri = $redirect_uri; if ($state) { $this->errorData['state'] = $state; } }
/** * * @param $http_status_code * HTTP status code message as predefined. * @param $error * The "error" attribute is used to provide the client with the reason * why the access request was declined. * @param $error_description * (optional) The "error_description" attribute provides a human-readable text * containing additional information, used to assist in the understanding * and resolution of the error occurred. * @param $scope * A space-delimited list of scope values indicating the required scope * of the access token for accessing the requested resource. */ public function __construct($httpCode, $tokenType, $realm, $error, $error_description = NULL, $scope = NULL) { $scope = (array) $scope; parent::__construct($httpCode, $error, $error_description); if ($scope) { $this->errorData['scope'] = implode(' ', $scope); } // Build header $this->header = sprintf('WWW-Authenticate: %s realm="%s"', ucwords($tokenType), $realm); foreach ($this->errorData as $key => $value) { $this->header .= sprintf(', %s="%s"', $key, $value); } }