Download the PHP package stromcom/auth-client without Composer
On this page you can find all versions of the php package stromcom/auth-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package auth-client
stromcom/auth-client
Official PHP client for the STROMCOM SSO server (auth.stromcom.cz). Implements OAuth 2.0 Authorization Code + PKCE, Client Credentials, JWT verification via JWKS with caching, UserInfo and logout. No framework dependencies, zero external JWT libraries.
Status: stable. Strict RFC 9068 for access tokens (
typ=at+jwt, required claimsiss,exp,aud,sub,client_id,iat,jti) and OIDC Core 1.0 §3.1.3.7 for id_tokens (audience,azp, nonce binding).Default issuer points to
https://auth.stromcom.cz. For local development against a dev auth server, overrideissueraccordingly.
Installation
Requirements: PHP 8.3+, ext-curl, ext-json, ext-openssl.
Runtime dependencies: lcobucci/jwt (and its transitive psr/clock).
That's it — no Guzzle, no PSR-7, no framework integration.
JWT parsing, signature verification and temporal-claim checks go through
lcobucci/jwt; JWKS fetching, caching, key-rotation orchestration and the
OAuth grant flows are in-house.
Quickstart
Web application — user login
Full walkthrough: docs/auth-code-flow.md.
Service account — machine-to-machine
For long-running processes, cache the token until it nears expiry — see examples/service-account-cached.php. Full walkthrough: docs/service-account.md.
Refresh
Logout
Logout clears the SSO session cookie on auth.stromcom.cz. Tokens you already
issued remain valid until their exp — clear your own cookies too.
Claims — object API
$auth->verify($jwt, $expectedAudience) returns a Claims value object.
Don't dig into the raw payload — use the rich API:
Full reference: docs/jwt-verification.md.
Configuration
| Parameter | Default | Description |
|---|---|---|
clientId |
(required) | cli_… / svc_… issued in the admin UI |
clientSecret |
null |
Required for confidential clients & client_credentials |
redirectUri |
null |
Required for authorization_code |
issuer |
https://auth.stromcom.cz |
Server base URL — for local dev use http://localhost:8003 |
defaultScopes |
['openid','profile','email','groups'] |
Used when beginAuthorization() is called without $scopes |
timeout |
10 |
HTTP timeout in seconds |
jwksTtl |
3600 |
JWKS cache TTL in seconds |
leeway |
30 |
JWT clock-skew tolerance in seconds |
userAgent |
stromcom-auth-client-php/1.0 |
Sent on every outbound request |
Endpoints are derived from issuer. To override (rare — e.g. a reverse
proxy), pass authorizationEndpoint, tokenEndpoint, userInfoEndpoint,
logoutEndpoint, jwksUri explicitly.
JWKS caching
The server publishes Cache-Control: max-age=3600 on /.well-known/jwks.json.
The verifier caches the document so per-request verification does not call the
auth server. Pick the backend that matches your runtime:
| Backend | Use it for |
|---|---|
InMemoryJwksCache |
Per-process. CLI scripts. Long-running workers (RoadRunner). |
ApcuJwksCache |
AWS Lambda (Bref) + any PHP-FPM — shared memory, fastest |
FileJwksCache |
Single-host without APCu (rare) |
Implement JwksCacheInterface for Redis/Memcached/PSR-16 backends. On kid
miss the cache is invalidated and re-fetched once automatically — that's
how key rotation works without restart.
Exceptions
| Class | When |
|---|---|
ConfigurationException |
Missing required field in Configuration |
TransportException |
Network failure (cURL error, DNS, TLS, timeout) |
OAuthServerException |
Auth server returned an error (e.g. invalid_grant, invalid_client). |
TokenVerificationException |
JWT signature / iss / aud / exp / typ / required-claim / nonce validation failed |
AuthorizationException |
Missing role / group / scope, wrong token_use |
AuthClientException |
Base — catch this for anything thrown by the SDK |
Full mapping with retry guidance: docs/error-handling.md.
Examples
| File | Demonstrates |
|---|---|
| examples/web-app-callback.php | Full auth-code+PKCE flow (login / callback / api / logout) |
| examples/service-token.php | M2M client_credentials, one-shot |
| examples/service-account-cached.php | M2M with token caching for long-running workers |
| examples/verify-token.php | Resource-server style: verify Bearer JWT on inbound requests |
| examples/psr15-middleware.php | Reusable PSR-15 middleware for any PSR-15 framework |
| examples/lambda-handler.php | AWS Lambda (Bref) handler with APCu-backed JWKS cache |
| examples/scope-authorization.php | Scope/role-based access control patterns |
| examples/smoke.php | End-to-end smoke against a running auth server |
Local development against a dev auth server
Testing
Unit tests use no network and no live auth server. To smoke-test the wire
protocol against a running server, run examples/smoke.php with valid
credentials in env.
Further reading
- docs/architecture.md — package internals, design decisions
- docs/auth-code-flow.md — web app deep dive (PKCE, state, callback)
- docs/service-account.md — M2M deep dive (caching, retry, secret rotation)
- docs/jwt-verification.md — JWKS, claim semantics, key rotation
- docs/error-handling.md — exception hierarchy, retry strategy
- docs/security.md — PKCE, state, secret storage, token storage
- CHANGELOG.md
For contributors and AI assistants working on this package: CLAUDE.md.
License
MIT. See LICENSE.
All versions of auth-client with dependencies
ext-curl Version *
ext-json Version *
ext-openssl Version *
lcobucci/jwt Version ^5.5