Обновлены роуты для oAuth2 запросов по последней спеке

This commit is contained in:
ErickSkrauch 2016-07-27 01:11:13 +03:00
parent 31679b84cb
commit c25bfeb8bc
3 changed files with 11 additions and 9 deletions

View File

@ -3,4 +3,6 @@ return [
'/accounts/change-email/initialize' => 'accounts/change-email-initialize', '/accounts/change-email/initialize' => 'accounts/change-email-initialize',
'/accounts/change-email/submit-new-email' => 'accounts/change-email-submit-new-email', '/accounts/change-email/submit-new-email' => 'accounts/change-email-submit-new-email',
'/accounts/change-email/confirm-new-email' => 'accounts/change-email-confirm-new-email', '/accounts/change-email/confirm-new-email' => 'accounts/change-email-confirm-new-email',
'/oauth2/v1/<action>' => 'oauth/<action>',
]; ];

View File

@ -16,13 +16,13 @@ class OauthController extends Controller {
public function behaviors() { public function behaviors() {
return ArrayHelper::merge(parent::behaviors(), [ return ArrayHelper::merge(parent::behaviors(), [
'authenticator' => [ 'authenticator' => [
'except' => ['validate', 'issue-token'], 'except' => ['validate', 'token'],
], ],
'access' => [ 'access' => [
'class' => AccessControl::class, 'class' => AccessControl::class,
'rules' => [ 'rules' => [
[ [
'actions' => ['validate', 'issue-token'], 'actions' => ['validate', 'token'],
'allow' => true, 'allow' => true,
'roles' => ['?'], 'roles' => ['?'],
], ],
@ -38,9 +38,9 @@ class OauthController extends Controller {
public function verbs() { public function verbs() {
return [ return [
'validate' => ['GET'], 'validate' => ['GET'],
'complete' => ['POST'], 'complete' => ['POST'],
'issue-token' => ['POST'], 'token' => ['POST'],
]; ];
} }
@ -166,7 +166,7 @@ class OauthController extends Controller {
* *
* @return array * @return array
*/ */
public function actionIssueToken() { public function actionToken() {
$this->attachRefreshTokenGrantIfNeedle(); $this->attachRefreshTokenGrantIfNeedle();
try { try {
$response = $this->getServer()->issueAccessToken(); $response = $this->getServer()->issueAccessToken();

View File

@ -9,17 +9,17 @@ use yii\codeception\BasePage;
class OauthRoute extends BasePage { class OauthRoute extends BasePage {
public function validate($queryParams) { public function validate($queryParams) {
$this->route = ['oauth/validate']; $this->route = '/oauth2/v1/validate';
$this->actor->sendGET($this->getUrl($queryParams)); $this->actor->sendGET($this->getUrl($queryParams));
} }
public function complete($queryParams = [], $postParams = []) { public function complete($queryParams = [], $postParams = []) {
$this->route = ['oauth/complete']; $this->route = '/oauth2/v1/complete';
$this->actor->sendPOST($this->getUrl($queryParams), $postParams); $this->actor->sendPOST($this->getUrl($queryParams), $postParams);
} }
public function issueToken($postParams = []) { public function issueToken($postParams = []) {
$this->route = ['oauth/issue-token']; $this->route = '/oauth2/v1/token';
$this->actor->sendPOST($this->getUrl(), $postParams); $this->actor->sendPOST($this->getUrl(), $postParams);
} }