From c25bfeb8bc7b010b95d5c3996e89fceb972e63b8 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Wed, 27 Jul 2016 01:11:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=80=D0=BE=D1=83=D1=82=D1=8B=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20oAuth2=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=BF=D0=BE=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=D0=B4?= =?UTF-8?q?=D0=BD=D0=B5=D0=B9=20=D1=81=D0=BF=D0=B5=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/config/routes.php | 2 ++ api/controllers/OauthController.php | 12 ++++++------ tests/codeception/api/_pages/OauthRoute.php | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/api/config/routes.php b/api/config/routes.php index d1ee9cf..491daee 100644 --- a/api/config/routes.php +++ b/api/config/routes.php @@ -3,4 +3,6 @@ return [ '/accounts/change-email/initialize' => 'accounts/change-email-initialize', '/accounts/change-email/submit-new-email' => 'accounts/change-email-submit-new-email', '/accounts/change-email/confirm-new-email' => 'accounts/change-email-confirm-new-email', + + '/oauth2/v1/' => 'oauth/', ]; diff --git a/api/controllers/OauthController.php b/api/controllers/OauthController.php index 291824b..0a0328f 100644 --- a/api/controllers/OauthController.php +++ b/api/controllers/OauthController.php @@ -16,13 +16,13 @@ class OauthController extends Controller { public function behaviors() { return ArrayHelper::merge(parent::behaviors(), [ 'authenticator' => [ - 'except' => ['validate', 'issue-token'], + 'except' => ['validate', 'token'], ], 'access' => [ 'class' => AccessControl::class, 'rules' => [ [ - 'actions' => ['validate', 'issue-token'], + 'actions' => ['validate', 'token'], 'allow' => true, 'roles' => ['?'], ], @@ -38,9 +38,9 @@ class OauthController extends Controller { public function verbs() { return [ - 'validate' => ['GET'], - 'complete' => ['POST'], - 'issue-token' => ['POST'], + 'validate' => ['GET'], + 'complete' => ['POST'], + 'token' => ['POST'], ]; } @@ -166,7 +166,7 @@ class OauthController extends Controller { * * @return array */ - public function actionIssueToken() { + public function actionToken() { $this->attachRefreshTokenGrantIfNeedle(); try { $response = $this->getServer()->issueAccessToken(); diff --git a/tests/codeception/api/_pages/OauthRoute.php b/tests/codeception/api/_pages/OauthRoute.php index 0a4118a..ae9d2aa 100644 --- a/tests/codeception/api/_pages/OauthRoute.php +++ b/tests/codeception/api/_pages/OauthRoute.php @@ -9,17 +9,17 @@ use yii\codeception\BasePage; class OauthRoute extends BasePage { public function validate($queryParams) { - $this->route = ['oauth/validate']; + $this->route = '/oauth2/v1/validate'; $this->actor->sendGET($this->getUrl($queryParams)); } public function complete($queryParams = [], $postParams = []) { - $this->route = ['oauth/complete']; + $this->route = '/oauth2/v1/complete'; $this->actor->sendPOST($this->getUrl($queryParams), $postParams); } public function issueToken($postParams = []) { - $this->route = ['oauth/issue-token']; + $this->route = '/oauth2/v1/token'; $this->actor->sendPOST($this->getUrl(), $postParams); }