Commit 8a3fe891 by Qiang Xue

renamed "auth" to "authenticator". [skip ci]

parent 83da0cd0
...@@ -603,17 +603,17 @@ Yii supports all of the above authentication methods. You can also easily create ...@@ -603,17 +603,17 @@ Yii supports all of the above authentication methods. You can also easily create
To enable authentication for your APIs, do the following two steps: To enable authentication for your APIs, do the following two steps:
1. Specify which authentication methods you plan to use by configuring the `auth` behavior 1. Specify which authentication methods you plan to use by configuring the `authenticator` behavior
in your REST controller classes. in your REST controller classes.
2. Implement [[yii\web\IdentityInterface::findIdentityByAccessToken()]] in your [[yii\web\User::identityClass|user identity class]]. 2. Implement [[yii\web\IdentityInterface::findIdentityByAccessToken()]] in your [[yii\web\User::identityClass|user identity class]].
For example, to enable all three authentication methods explained above, you can configure `auth` like following, For example, to enable all three authentication methods explained above, you can configure `authenticator` like following,
```php ```php
public function behaviors() public function behaviors()
{ {
return array_merge(parent::behaviors(), [ return array_merge(parent::behaviors(), [
'auth' => [ 'authenticator' => [
'authMethods' => [ 'authMethods' => [
\yii\filters\auth\HttpBasicAuth::className(), \yii\filters\auth\HttpBasicAuth::className(),
\yii\filters\auth\QueryParamAuth::className(), \yii\filters\auth\QueryParamAuth::className(),
...@@ -633,7 +633,7 @@ If you only want to a single authentication method, such as HTTP Basic Auth, you ...@@ -633,7 +633,7 @@ If you only want to a single authentication method, such as HTTP Basic Auth, you
public function behaviors() public function behaviors()
{ {
return array_merge(parent::behaviors(), [ return array_merge(parent::behaviors(), [
'auth' => [ 'authenticator' => [
'class' => \yii\filters\auth\HttpBasicAuth::className(), 'class' => \yii\filters\auth\HttpBasicAuth::className(),
], ],
]); ]);
......
...@@ -74,7 +74,7 @@ class Controller extends \yii\web\Controller ...@@ -74,7 +74,7 @@ class Controller extends \yii\web\Controller
'class' => VerbFilter::className(), 'class' => VerbFilter::className(),
'actions' => $this->verbs(), 'actions' => $this->verbs(),
], ],
'auth' => [ 'authenticator' => [
'class' => CompositeAuth::className(), 'class' => CompositeAuth::className(),
], ],
'rateLimiter' => [ 'rateLimiter' => [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment