芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal-back/vendor/yiisoft/yii2/filters/auth/CompositeAuth.php
[ * 'class' => \yii\filters\auth\CompositeAuth::class, * 'authMethods' => [ * \yii\filters\auth\HttpBasicAuth::class, * \yii\filters\auth\QueryParamAuth::class, * ], * ], * ]; * } * ``` * * @author Qiang Xue
* @since 2.0 */ class CompositeAuth extends AuthMethod { /** * @var array the supported authentication methods. This property should take a list of supported * authentication methods, each represented by an authentication class or configuration. * * If this property is empty, no authentication will be performed. * * Note that an auth method class must implement the [[\yii\filters\auth\AuthInterface]] interface. */ public $authMethods = []; /** * {@inheritdoc} */ public function beforeAction($action) { return empty($this->authMethods) ? true : parent::beforeAction($action); } /** * {@inheritdoc} */ public function authenticate($user, $request, $response) { foreach ($this->authMethods as $i => $auth) { if (!$auth instanceof AuthInterface) { $this->authMethods[$i] = $auth = Yii::createObject($auth); if (!$auth instanceof AuthInterface) { throw new InvalidConfigException(get_class($auth) . ' must implement yii\filters\auth\AuthInterface'); } } if ( $this->owner instanceof Controller && ( !isset($this->owner->action) || ( $auth instanceof ActionFilter && !$auth->isActive($this->owner->action) ) ) ) { continue; } $identity = $auth->authenticate($user, $request, $response); if ($identity !== null) { return $identity; } } return null; } /** * {@inheritdoc} */ public function challenge($response) { foreach ($this->authMethods as $method) { /** @var AuthInterface $method */ $method->challenge($response); } } }