AuthenticatorInterface
Generalizes Quiote\Mcp\Auth\McpAuthenticatorInterface into a framework-wide contract: one implementation per credential mechanism (form login, HTTP Basic, bearer/JWT, OIDC).
A firewall runs its ordered authenticator chain, calling supports() to pick the first match, then authenticate().
Synopsis
Section titled “Synopsis”interface AuthenticatorInterface
| Implemented by | FormLoginAuthenticator, HttpBasicAuthenticator, BearerTokenAuthenticator, OidcAuthenticator |
| Since | 1.0.0 |
| Source | Security/Auth/AuthenticatorInterface.php |
Methods
Section titled “Methods”| Method | Description |
|---|---|
authenticate(ServerRequestInterface $request): Passport | Extract and validate this authenticator’s credential from $request and resolve it to an identity. |
onFailure(AuthenticationException $exception): ?ResponseInterface | Optional authenticator-specific failure response (e.g. |
supports(ServerRequestInterface $request): bool | Whether this authenticator can attempt to extract a credential from $request (e.g. |
authenticate()
Section titled “authenticate()”abstract public function authenticate(ServerRequestInterface $request): Passport
Extract and validate this authenticator’s credential from $request and resolve it to an identity.
The incoming request. Only ever called after supports() returned true for it.
| Parameter | Type | Description |
|---|---|---|
$request | ServerRequestInterface | The incoming request. Only ever called after supports() returned true for it. |
Returns Passport — The resolved identity, credentials/roles, and statelessness flag.
| Throws | When |
|---|---|
AuthenticationException | If the presented credential is absent, malformed, or invalid. |
onFailure()
Section titled “onFailure()”abstract public function onFailure(AuthenticationException $exception): ?ResponseInterface
Optional authenticator-specific failure response (e.g.
The exception thrown by authenticate().
| Parameter | Type | Description |
|---|---|---|
$exception | AuthenticationException | The exception thrown by authenticate(). |
Returns ?ResponseInterface — A response to short-circuit with, or null to defer to the firewall’s entry point.
supports()
Section titled “supports()”abstract public function supports(ServerRequestInterface $request): bool
Whether this authenticator can attempt to extract a credential from $request (e.g.
The incoming request.
| Parameter | Type | Description |
|---|---|---|
$request | ServerRequestInterface | The incoming request. |
Returns bool — True if this authenticator should attempt authenticate(), otherwise false.