Skip to content

Commit

Permalink
Fixes yiisoft#7409: Allow `yii\filters\auth\CompositeAuth::authMethod…
Browse files Browse the repository at this point in the history
…s` to take authentication objects
  • Loading branch information
qiangxue committed Apr 5, 2015
1 parent ee4cdfe commit 23d8ced
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Yii Framework 2 Change Log
- Bug #7957: Removed extra `parseFloat()` call for the `compare` js validator (CthulhuDen)
- Enh #6895: Added `ignoreCategories` config option for message command to ignore categories specified (samdark)
- Enh #6975: Pressing arrows while focused in inputs of Active Form with `validateOnType` enabled no longer triggers validation (slinstj)
- Enh #7409: Allow `yii\filters\auth\CompositeAuth::authMethods` to take authentication objects (fernandezekiel, qiangxue)
- Enh #7488: Added `StringHelper::explode` to perform explode with trimming and skipping of empty elements (SilverFire, nineinchnick, creocoder, samdark)
- Enh #7530: Improved default values for `yii\data\Sort` link labels in a `ListView` when used with an `ActiveDataProvider` (cebe)
- Enh #7539: `yii\console\controllers\AssetController` provides dependency trace in case bundle circular dependency detected (klimov-paul)
Expand Down
6 changes: 4 additions & 2 deletions framework/filters/auth/CompositeAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ public function beforeAction($action)
public function authenticate($user, $request, $response)
{
foreach ($this->authMethods as $i => $auth) {
$this->authMethods[$i] = $auth = Yii::createObject($auth);
if (!$auth instanceof AuthInterface) {
throw new InvalidConfigException(get_class($auth) . ' must implement yii\filters\auth\AuthInterface');
$this->authMethods[$i] = $auth = Yii::createObject($auth);
if (!$auth instanceof AuthInterface) {
throw new InvalidConfigException(get_class($auth) . ' must implement yii\filters\auth\AuthInterface');
}
}

$identity = $auth->authenticate($user, $request, $response);
Expand Down

0 comments on commit 23d8ced

Please sign in to comment.