Final Class Yiisoft\Auth\Handler\AuthenticationFailureHandler
| Inheritance | Yiisoft\Auth\Handler\AuthenticationFailureHandler |
|---|---|
| Implements | Psr\Http\Server\RequestHandlerInterface |
Default authentication failure handler. Responds with "401 Unauthorized" HTTP status code.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Auth\Handler\AuthenticationFailureHandler | |
| handle() | Yiisoft\Auth\Handler\AuthenticationFailureHandler |
Method Details
| public mixed __construct ( \Psr\Http\Message\ResponseFactoryInterface $responseFactory ) | ||
| $responseFactory | \Psr\Http\Message\ResponseFactoryInterface | |
public function __construct(private ResponseFactoryInterface $responseFactory)
{
}
| public \Psr\Http\Message\ResponseInterface handle ( \Psr\Http\Message\ServerRequestInterface $request ) | ||
| $request | \Psr\Http\Message\ServerRequestInterface | |
public function handle(ServerRequestInterface $request): ResponseInterface
{
$response = $this->responseFactory->createResponse(Status::UNAUTHORIZED);
$response
->getBody()
->write('Your request was made with invalid credentials.');
return $response;
}
Signup or Login in order to comment.