Note that this method does not deal with session or cookie. You should usually use User::switchIdentity
to change the identity of the current user.
public setIdentity ( yii\web\IdentityInterface | null $identity ) | ||
$identity | yii\web\IdentityInterface | null | the identity object associated with the currently logged user. If null, it means the current user will be a guest without any associated identity. |