Final Class Yiisoft\Auth\Method\QueryParameter
| Inheritance | Yiisoft\Auth\Method\QueryParameter |
|---|---|
| Implements | Yiisoft\Auth\AuthenticationMethodInterface |
QueryParameter supports the authentication based on the access token passed through a query parameter.
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
{
$accessToken = $request->getQueryParams()[$this->parameterName] ?? null;
if (is_string($accessToken)) {
return $this->identityRepository->findIdentityByToken($accessToken, $this->tokenType);
}
return null;
}
| 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 withParameterName( string $name ): $this | ||
| $name | string |
The parameter name for passing the access token. |
public function withParameterName(string $name): self
{
$new = clone $this;
$new->parameterName = $name;
return $new;
}
Signup or Login in order to comment.