mirror of
https://github.com/elyby/accounts.git
synced 2025-01-10 22:12:03 +05:30
Remove authserver module restriction [deploy]
This commit is contained in:
parent
5dc140da15
commit
077db4f328
@ -5,25 +5,15 @@ namespace api\modules\authserver;
|
|||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\BootstrapInterface;
|
use yii\base\BootstrapInterface;
|
||||||
use yii\web\NotFoundHttpException;
|
use yii\base\Module as BaseModule;
|
||||||
use yii\web\Response;
|
use yii\web\Response;
|
||||||
|
|
||||||
class Module extends \yii\base\Module implements BootstrapInterface {
|
class Module extends BaseModule implements BootstrapInterface {
|
||||||
|
|
||||||
public $id = 'authserver';
|
public $id = 'authserver';
|
||||||
|
|
||||||
public $defaultRoute = 'index';
|
public $defaultRoute = 'index';
|
||||||
|
|
||||||
public function beforeAction($action): bool {
|
|
||||||
if (!parent::beforeAction($action)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->checkHost();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function afterAction($action, $result) {
|
public function afterAction($action, $result) {
|
||||||
if ($result === null) {
|
if ($result === null) {
|
||||||
Yii::$app->response->format = Response::FORMAT_RAW;
|
Yii::$app->response->format = Response::FORMAT_RAW;
|
||||||
@ -50,16 +40,4 @@ class Module extends \yii\base\Module implements BootstrapInterface {
|
|||||||
Yii::info($message, 'legacy-authserver');
|
Yii::info($message, 'legacy-authserver');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Since this is a legacy method and there will be no documentation for it in the new environment,
|
|
||||||
* there is no point in displaying the internal API, so we are limiting access only to logons from the old domain.
|
|
||||||
*
|
|
||||||
* @throws NotFoundHttpException
|
|
||||||
*/
|
|
||||||
protected function checkHost() {
|
|
||||||
if (parse_url(Yii::$app->request->getHostInfo(), PHP_URL_HOST) !== Yii::$app->params['authserverHost']) {
|
|
||||||
throw new NotFoundHttpException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user