Remove authserver module restriction [deploy]

This commit is contained in:
ErickSkrauch 2021-03-05 16:07:55 +01:00
parent 5dc140da15
commit 077db4f328

View File

@ -5,25 +5,15 @@ namespace api\modules\authserver;
use Yii;
use yii\base\BootstrapInterface;
use yii\web\NotFoundHttpException;
use yii\base\Module as BaseModule;
use yii\web\Response;
class Module extends \yii\base\Module implements BootstrapInterface {
class Module extends BaseModule implements BootstrapInterface {
public $id = 'authserver';
public $defaultRoute = 'index';
public function beforeAction($action): bool {
if (!parent::beforeAction($action)) {
return false;
}
$this->checkHost();
return true;
}
public function afterAction($action, $result) {
if ($result === null) {
Yii::$app->response->format = Response::FORMAT_RAW;
@ -50,16 +40,4 @@ class Module extends \yii\base\Module implements BootstrapInterface {
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();
}
}
}