AuthInterface
API reference › yii › filters › auth › AuthInterface
Implemented by 1 type
AuthInterface is the interface that should be implemented by auth method classes.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
authenticate() abstract | Authenticates the current user. | AuthInterface |
challenge() abstract | Generates challenges upon authentication failure. | AuthInterface |
handleFailure() abstract | Handles authentication failure. | AuthInterface |
Method details
Section titled “Method details”authenticate()
Section titled “authenticate() ”abstract public function authenticate(yii\web\User $user, yii\web\Request $request, yii\web\Response $response): yii\web\IdentityInterface|nullAuthenticates the current user.
Parameters
| Parameter | Type | Description |
|---|---|---|
$user | yii\ | |
$request | yii\ | |
$response | yii\ |
Returns
yii\web\IdentityInterface|null: 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.
challenge()
Section titled “challenge() ”abstract public function challenge(yii\web\Response $response): mixedGenerates challenges upon authentication failure.
For example, some appropriate HTTP headers may be generated.
handleFailure()
Section titled “handleFailure() ”abstract public function handleFailure(yii\web\Response $response): mixedHandles authentication failure.
The implementation should normally throw UnauthorizedHttpException to indicate authentication failure.