Search by

adachsoft / oidc-provider-web-token

Arkadiusz Adach

ES256 signing-key generation, JWT signing, and token verification for OIDC provider applications.

Package info

gitlab.com/a.adach/oidc-provider-web-token

Issues

pkg:composer/adachsoft/oidc-provider-web-token

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-11-27 07:10 UTC

This package is auto-updated.

Last update: 2026-11-27 06:10:30 UTC


README

adachsoft/oidc-provider-web-token implements the signing-key generator, token signer, and token verifier contracts from adachsoft/oidc-provider-contracts using web-token/jwt-library. All key generation, signing, and signature verification are delegated to web-token.

Requirements and installation

  • PHP ^8.3
  • adachsoft/oidc-provider-contracts:^0.1
  • web-token/jwt-library:^4.2 (the latest stable release compatible with PHP 8.3)

Install the adapter with Composer:

composer require adachsoft/oidc-provider-web-token

Usage

Wiring

Register the adapter implementations for the corresponding contracts and provide your application's repository, clock, key-ID, token, and claims services:

use AdachSoft\OidcProviderContracts\Dto\ProviderPolicyDto;
use AdachSoft\OidcProviderContracts\Service\SigningKeyService;
use AdachSoft\OidcProviderContracts\Service\TokenIssuer;
use AdachSoft\OidcProviderWebToken\WebTokenSigner;
use AdachSoft\OidcProviderWebToken\WebTokenSigningKeyGenerator;
use AdachSoft\OidcProviderWebToken\WebTokenVerifier;
use DateInterval;

$keyGenerator = new WebTokenSigningKeyGenerator();
$signer = new WebTokenSigner();
$verifier = new WebTokenVerifier();

$signingKeys = new SigningKeyService(
    $signingKeyRepository,
    $keyGenerator,
    $keyIdGenerator,
    $clock,
    new DateInterval('P2D'),
);

$tokenIssuer = new TokenIssuer(
    $signer,
    $signingKeys,
    $clock,
    new ProviderPolicyDto('https://identity.example.com'),
    $tokenGenerator,
    $refreshTokenRepository,
    $claimsProvider,
);

Use TokenVerifierInterface consumers with the published keys and an explicit issuer, audience, time, and leeway expectation. JwksDocumentFactory from oidc-provider-contracts can publish the same keys as a public JWKS document.

Key format and supported algorithm

The adapter currently supports ES256 with EC P-256 keys. A signing key's opaque privateKey value is the full private JWK serialized as JSON; its public JWK contains only kty, crv, x, y, kid, alg, and use.

Treat the private JWK JSON as a secret: restrict access, avoid logging it, and protect it at rest. Only the public JWK is used when verifying signatures.

Security notes

  • Verification pins the JWS alg to the selected key's algorithm and supports only ES256.
  • The none algorithm and HMAC algorithms are rejected; algorithm negotiation from an untrusted token is not allowed.
  • Verification constructs its cryptographic key from the key record's public JWK and never loads privateKey.
  • Tokens are accepted only after signature, issuer, audience, expiration, not-before, and issued-at checks succeed.