AuthenticatorInterface
All authenticators must implement theAuthenticatorInterface.
Methods
authenticate(string $token): ?AbstractAuthIdentity: Takes a raw token (or credential string) and returns an identity object if valid, ornullif authentication fails.
JwtAuthenticator
Apivalk provides a production-readyJwtAuthenticator that uses the firebase/php-jwt library. It is designed to work with OAuth2 providers (like Auth0, Okta, or Keycloak) that expose a JWKS (JSON Web Key Set) endpoint.
Features
- JWKS Support: Automatically fetches and parses public keys from a remote URL.
- Claim Validation: Validates the
iss(issuer),aud(audience), andexp(expiration) claims. - Scope Extraction: Automatically parses scopes from the
scopeorscpclaims. - Identity Creation: Returns a
UserAuthIdentitypopulated with thesubclaim and all other JWT claims.