0 follower

Final Class Yiisoft\Auth\Method\HttpCookie

InheritanceYiisoft\Auth\Method\HttpCookie
ImplementsYiisoft\Auth\AuthenticationMethodInterface

HTTP cookie authentication method.

See also https://tools.ietf.org/html/rfc6265.

Method Details

Hide inherited methods

__construct() public method

public __construct( Yiisoft\Auth\IdentityWithTokenRepositoryInterface $identityRepository ): mixed
$identityRepository Yiisoft\Auth\IdentityWithTokenRepositoryInterface

                public function __construct(
    private IdentityWithTokenRepositoryInterface $identityRepository,
) {}

            
authenticate() public method

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);
}

            
challenge() public method

public challenge( \Psr\Http\Message\ResponseInterface $response ): \Psr\Http\Message\ResponseInterface
$response \Psr\Http\Message\ResponseInterface

                public function challenge(ResponseInterface $response): ResponseInterface
{
    return $response;
}

            
withCookieName() public method

public withCookieName( string $cookieName ): self
$cookieName string

                public function withCookieName(string $cookieName): self
{
    $new = clone $this;
    $new->cookieName = $cookieName;
    return $new;
}

            
withTokenType() public method

public withTokenType( string|null $type ): self
$type string|null

                public function withTokenType(?string $type): self
{
    $new = clone $this;
    $new->tokenType = $type;
    return $new;
}