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 mixed __construct ( Yiisoft\Auth\IdentityWithTokenRepositoryInterface $identityRepository ) | ||
| $identityRepository | Yiisoft\Auth\IdentityWithTokenRepositoryInterface | |
public function __construct(private IdentityWithTokenRepositoryInterface $identityRepository)
{
}
| public Yiisoft\Auth\IdentityInterface|null authenticate ( \Psr\Http\Message\ServerRequestInterface $request ) | ||
| $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 \Psr\Http\Message\ResponseInterface challenge ( \Psr\Http\Message\ResponseInterface $response ) | ||
| $response | \Psr\Http\Message\ResponseInterface | |
public function challenge(ResponseInterface $response): ResponseInterface
{
return $response;
}
| public $this withParameterName ( string $name ) | ||
| $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.