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 mixed __construct ( Yiisoft\Auth\IdentityWithTokenRepositoryInterface $identityRepository )
$identityRepository Yiisoft\Auth\IdentityWithTokenRepositoryInterface

                public function __construct(
    private IdentityWithTokenRepositoryInterface $identityRepository
) {
}

            
authenticate() public method

public Yiisoft\Auth\IdentityInterface|null authenticate ( \Psr\Http\Message\ServerRequestInterface $request )
$request \Psr\Http\Message\ServerRequestInterface

                public function authenticate(ServerRequestInterface $request): IdentityInterface|null
{
    $authToken = $this->getAuthenticationToken($request);
    if ($authToken === null) {
        return null;
    }
    return $this->identityRepository->findIdentityByToken($authToken, $this->tokenType);
}

            
challenge() public method

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

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

            
withCookieName() public method

public self withCookieName ( string $cookieName )
$cookieName string

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

            
withTokenType() public method

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

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