Final Class Yiisoft\Auth\Method\HttpCookie
| Inheritance | Yiisoft\Auth\Method\HttpCookie |
|---|---|
| Implements | Yiisoft\Auth\AuthenticationMethodInterface |
HTTP cookie authentication method.
See also https://tools.ietf.org/html/rfc6265.
Public Methods
Method Details
| public __construct( Yiisoft\Auth\IdentityWithTokenRepositoryInterface $identityRepository ): mixed | ||
| $identityRepository | Yiisoft\Auth\IdentityWithTokenRepositoryInterface | |
public function __construct(
private IdentityWithTokenRepositoryInterface $identityRepository,
) {}
| public authenticate( \Psr\Http\Message\ServerRequestInterface $request ): Yiisoft\Auth\IdentityInterface|null | ||
| $request | \Psr\Http\Message\ServerRequestInterface | |
public function authenticate(ServerRequestInterface $request): ?IdentityInterface
{
$authToken = $this->getAuthenticationToken($request);
if ($authToken === null) {
return null;
}
return $this->identityRepository->findIdentityByToken($authToken, $this->tokenType);
}
| public challenge( \Psr\Http\Message\ResponseInterface $response ): \Psr\Http\Message\ResponseInterface | ||
| $response | \Psr\Http\Message\ResponseInterface | |
public function challenge(ResponseInterface $response): ResponseInterface
{
return $response;
}
| public withCookieName( string $cookieName ): self | ||
| $cookieName | string | |
public function withCookieName(string $cookieName): self
{
$new = clone $this;
$new->cookieName = $cookieName;
return $new;
}
| public withTokenType( string|null $type ): self | ||
| $type | string|null | |
public function withTokenType(?string $type): self
{
$new = clone $this;
$new->tokenType = $type;
return $new;
}
Signup or Login in order to comment.