yii\filters\auth\AuthInterface - Yii2 类参考手册
Interface yii\filters\auth\AuthInterface
全部
| 方法 Methods
Implemented by | yii\filters\auth\AuthMethod, yii\filters\auth\CompositeAuth, yii\filters\auth\HttpBasicAuth, yii\filters\auth\HttpBearerAuth, yii\filters\auth\HttpHeaderAuth, yii\filters\auth\QueryParamAuth |
---|---|
Available since version | 2.0 |
AuthInterface is the interface that should be implemented by auth method classes.
Public Methods
隐藏继承的方法 Hide inherited methods
方法 Method | 简介 Description | 定义在 Defined By |
---|---|---|
authenticate() | Authenticates the current user. | yii\filters\auth\AuthInterface |
challenge() | Generates challenges upon authentication failure. | yii\filters\auth\AuthInterface |
handleFailure() | Handles authentication failure. | yii\filters\auth\AuthInterface |
方法详情 Method Details
Authenticates the current user.
public abstract yii\web\IdentityInterface authenticate ( $user, $request, $response ) | ||
$user | yii\web\User | |
$request | yii\web\Request | |
$response | yii\web\Response | |
return | yii\web\IdentityInterface | The authenticated user identity. If authentication information is not provided, null will be returned. |
---|---|---|
throws | yii\web\UnauthorizedHttpException | if authentication information is provided but is invalid. |
Generates challenges upon authentication failure.
For example, some appropriate HTTP headers may be generated.
public abstract void challenge ( $response ) | ||
$response | yii\web\Response |
Handles authentication failure.
The implementation should normally throw UnauthorizedHttpException to indicate authentication failure.
public abstract void handleFailure ( $response ) | ||
$response | yii\web\Response | |
throws | yii\web\UnauthorizedHttpException |
---|