public function validateRedirect_uri($attribute, $params) { $authCode = $this->getAuthCode(); if ($authCode->redirect_uri && strcasecmp($this->{$attribute}, $authCode->redirect_uri) !== 0) { $this->errorServer('The redirect URI provided does not match', Exception::REDIRECT_URI_MISMATCH); } parent::validateRedirect_uri($attribute, $params); }
public function run() { if (!($grantType = BaseModel::getRequestValue('grant_type'))) { throw new Exception('The grant type was not specified in the request'); } if (isset($this->grantTypes[$grantType])) { $grantModel = \Yii::createObject($this->grantTypes[$grantType]); } else { throw new Exception("An unsupported grant type was requested", Exception::UNSUPPORTED_GRANT_TYPE); } $grantModel->validate(); \Yii::$app->response->data = $grantModel->getResponseData(); }
/** * Performs OAuth 2.0 request validation and store granttype object in the session, * so, user can go from our authorization server to the third party OAuth provider. * You should call finishAuthorization() in the current controller to finish client authorization * or to stop with Access Denied error message if the user is not logged on. */ public function beforeAction($action) { if (!($responseType = BaseModel::getRequestValue('response_type'))) { throw new Exception('Invalid or missing response type'); } if (isset($this->responseTypes[$responseType])) { $this->_responseType = \Yii::createObject($this->responseTypes[$responseType]); } else { throw new Exception("An unsupported response type was requested.", Exception::UNSUPPORTED_RESPONSE_TYPE); } $this->_responseType->validate(); if ($this->storeKey) { \Yii::$app->session->set($this->storeKey, serialize($this->_responseType)); } return true; }