filters\auth\HttpBasicAuth $auth

$auth public property

A PHP callable that will authenticate the user with the HTTP basic auth information. The callable receives a username and a password as its parameters. It should return an identity object that matches the username and password. Null should be returned if there is no such identity.

The following code is a typical implementation of this callable:

function ($username, $password) {
    return \app\models\User::findOne([
        'username' => $username,
        'password' => $password,
    ]);
}

If this property is not set, the username information will be considered as an access token while the password information will be ignored. The yii\web\User::loginByAccessToken() method will be called to authenticate and login the user.

public callable $auth = null
doc_Yii
2016-10-30 17:02:29
Comments
Leave a Comment

Please login to continue.