2016-08-21 04:51:39 +05:30
|
|
|
<?php
|
2019-02-21 01:28:52 +05:30
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-08-21 04:51:39 +05:30
|
|
|
namespace api\modules\authserver;
|
|
|
|
|
2016-08-29 04:47:45 +05:30
|
|
|
use Yii;
|
2016-08-21 04:51:39 +05:30
|
|
|
use yii\base\BootstrapInterface;
|
2021-03-05 20:37:55 +05:30
|
|
|
use yii\base\Module as BaseModule;
|
2019-06-18 05:03:20 +05:30
|
|
|
use yii\web\Response;
|
2016-08-21 04:51:39 +05:30
|
|
|
|
2021-03-05 20:37:55 +05:30
|
|
|
class Module extends BaseModule implements BootstrapInterface {
|
2016-08-21 04:51:39 +05:30
|
|
|
|
|
|
|
public $id = 'authserver';
|
|
|
|
|
|
|
|
public $defaultRoute = 'index';
|
|
|
|
|
2019-06-18 05:03:20 +05:30
|
|
|
public function afterAction($action, $result) {
|
|
|
|
if ($result === null) {
|
|
|
|
Yii::$app->response->format = Response::FORMAT_RAW;
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::afterAction($action, $result);
|
|
|
|
}
|
|
|
|
|
2016-08-21 04:51:39 +05:30
|
|
|
/**
|
2019-02-21 01:28:52 +05:30
|
|
|
* @param \yii\base\Application $app
|
2016-08-21 04:51:39 +05:30
|
|
|
*/
|
2019-06-18 05:03:20 +05:30
|
|
|
public function bootstrap($app): void {
|
2019-02-21 01:28:52 +05:30
|
|
|
$legacyHost = $app->params['authserverHost'];
|
2016-08-21 04:51:39 +05:30
|
|
|
$app->getUrlManager()->addRules([
|
2019-02-21 01:28:52 +05:30
|
|
|
"//{$legacyHost}/authserver/auth/<action>" => "{$this->id}/authentication/<action>",
|
2016-08-21 04:51:39 +05:30
|
|
|
], false);
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public static function info($message): void {
|
2016-08-29 04:47:45 +05:30
|
|
|
Yii::info($message, 'legacy-authserver');
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public static function error($message): void {
|
2016-08-29 04:47:45 +05:30
|
|
|
Yii::info($message, 'legacy-authserver');
|
|
|
|
}
|
|
|
|
|
2016-08-21 04:51:39 +05:30
|
|
|
}
|