Обновлены роуты для 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/submit-new-email' => 'accounts/change-email-submit-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() {
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();

View File

@ -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);
}