Replace emarref/jwt with lcobucci/jwt

Refactor all JWT-related components
Replace RS256 with ES256 as a preferred JWT algorithm
This commit is contained in:
ErickSkrauch
2019-08-01 12:17:12 +03:00
parent 4c2a9cc172
commit 45c2ed601d
47 changed files with 805 additions and 621 deletions

View File

@@ -51,7 +51,7 @@ class AuthenticationController extends Controller {
public function actionLogin() {
$model = new LoginForm();
$model->load(Yii::$app->request->post());
if (($result = $model->login()) === false) {
if (($result = $model->login()) === null) {
$data = [
'success' => false,
'errors' => $model->getFirstErrors(),
@@ -66,7 +66,7 @@ class AuthenticationController extends Controller {
return array_merge([
'success' => true,
], $result->getAsResponse());
], $result->formatAsOAuth2Response());
}
public function actionLogout() {
@@ -117,7 +117,7 @@ class AuthenticationController extends Controller {
public function actionRecoverPassword() {
$model = new RecoverPasswordForm();
$model->load(Yii::$app->request->post());
if (($result = $model->recoverPassword()) === false) {
if (($result = $model->recoverPassword()) === null) {
return [
'success' => false,
'errors' => $model->getFirstErrors(),
@@ -126,20 +126,20 @@ class AuthenticationController extends Controller {
return array_merge([
'success' => true,
], $result->getAsResponse());
], $result->formatAsOAuth2Response());
}
public function actionRefreshToken() {
$model = new RefreshTokenForm();
$model->load(Yii::$app->request->post());
if (($result = $model->renew()) === false) {
if (($result = $model->renew()) === null) {
return [
'success' => false,
'errors' => $model->getFirstErrors(),
];
}
$response = $result->getAsResponse();
$response = $result->formatAsOAuth2Response();
unset($response['refresh_token']);
return array_merge([