Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Jose Verifier Laravel Package

facile-it/php-jose-verifier

Validate and verify JWTs (JOSE) with builder-based verifiers geared for OAuth2/OpenID Connect. Create verifiers from issuer metadata (issuer, jwks_uri) and client metadata (client_id/secret), with optional JWK sets for decryption; ext-gmp recommended for speed.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • OAuth2/OpenID Connect Authentication: Enables secure validation of JWT tokens (access, ID, and userinfo) for authentication/authorization workflows, reducing dependency on third-party authentication services like Auth0 or Okta. This aligns with roadmap goals to reduce vendor lock-in and centralize identity management within Laravel-based applications.
  • Compliance and Security: Supports strict validation of JWT tokens according to OIDC/OAuth2 standards, including checks for auth_time, nonce, state, and s_hash. This is critical for meeting GDPR, HIPAA, or SOC2 compliance requirements, especially in regulated industries like healthcare or finance.
  • Build vs. Buy Decision: Replaces custom JWT validation logic or proprietary libraries (e.g., Firebase Auth SDKs) with an open-source, maintainable solution. This reduces technical debt and aligns with the company’s preference for self-hosted, transparent authentication systems.
  • API and Microservices Security: Validates JWT tokens in Laravel-based APIs or microservices, ensuring only authorized requests reach downstream services. This supports the API-first strategy and microservices architecture by enforcing security at the gateway level.
  • Performance Optimization: Leverages caching for JWKs (via Psr\SimpleCache) to reduce latency and improve scalability, which is critical for high-traffic applications. The recommendation to install ext-gmp further optimizes cryptographic operations.
  • Roadmap Priorities:
    • Phase 1: Integrate with existing OAuth2 providers (e.g., Keycloak, Auth0, or internal OAuth2 servers) to validate tokens in Laravel applications.
    • Phase 2: Extend functionality to support custom claim validation or token revocation checks via short-lived caches or introspection endpoints.
    • Phase 3: Add audit logging for token validation failures (e.g., expired tokens, invalid signatures) to enhance security monitoring and compliance reporting.

When to Consider This Package

  • Adopt if:

    • Your Laravel application relies on OAuth2/OpenID Connect for authentication/authorization (e.g., social logins, API access tokens, or internal OAuth2 flows).
    • You need compliance with OIDC/OAuth2 standards, including validation of nonce, state, auth_time, and other security-critical claims.
    • You want to avoid proprietary SDKs (e.g., Firebase Auth, AWS Cognito) and prefer an open-source, self-hosted solution.
    • Your team uses PHP/Laravel and prefers native libraries over JavaScript/Node.js alternatives.
    • You require performance optimizations for token validation, such as caching JWKs or leveraging ext-gmp for faster cryptographic operations.
    • Your PHP version is 8.1 or higher, as the package drops support for older versions.
  • Look elsewhere if:

    • Your application uses non-JWT tokens (e.g., session cookies, opaque tokens, or legacy OAuth1 tokens).
    • Your OAuth2/OpenID provider does not support JWKs (e.g., some legacy systems or custom token formats).
    • You need advanced token revocation features (e.g., real-time revocation checks), which would require additional integration with a revocation list service or introspection endpoint.
    • Your PHP environment is below version 8.1, as the package no longer supports older versions.
    • You require active community support or frequent updates, as the package has a relatively low number of stars (4) and dependents (0), though it is actively maintained.
    • You need multi-language support (e.g., for a polyglot microservices architecture), as this is a PHP-specific solution.

How to Pitch It (Stakeholders)

For Executives:

*"This package allows us to securely validate JWT tokens from OAuth2/OpenID Connect providers (e.g., Google, Microsoft, or internal systems) without relying on third-party authentication services. By adopting this solution, we can:

  • Reduce costs by eliminating vendor lock-in with proprietary auth services like Auth0 or Okta.
  • Enhance security and compliance by ensuring strict adherence to OIDC/OAuth2 standards, which is critical for meeting GDPR, HIPAA, or SOC2 requirements.
  • Future-proof our authentication infrastructure with a self-hosted, open-source solution that integrates seamlessly with our Laravel-based applications.
  • Improve performance by caching JWKs and optimizing cryptographic operations, which is especially important for high-traffic APIs and microservices.

This aligns with our strategic goals to centralize identity management and reduce technical debt while maintaining flexibility for future scalability."*


For Engineering Teams:

*"The Facile JOSE Verifier is a lightweight, PHP-native library designed to validate JWT tokens (access tokens, ID tokens, and userinfo) for OAuth2/OpenID Connect workflows. Here’s why it’s a strong fit for our stack:

Key Benefits:

  • Builder Pattern: Simplifies configuration using issuer metadata (e.g., issuer, jwks_uri) and client metadata (e.g., client_id, client_secret). This reduces boilerplate code and makes it easy to integrate with providers like Keycloak, Auth0, or internal OAuth2 servers.
  • Compliance-Ready: Supports strict validation of OIDC claims (e.g., auth_time, nonce, state, s_hash), ensuring we meet security and regulatory requirements.
  • Performance Optimized: Caching JWKs via Psr\SimpleCache reduces latency, and installing ext-gmp further speeds up cryptographic operations.
  • Immutable Verifiers: Thread-safe design makes it ideal for high-traffic applications, including API gateways and microservices.
  • Extensible: Can be customized to add support for custom claims or integrated with PSR-15 middleware for Laravel applications.

Implementation Example:

$issuerMetadata = ['issuer' => 'https://provider.com', 'jwks_uri' => 'https://provider.com/jwks'];
$clientMetadata = ['client_id' => 'your-client-id', 'client_secret' => 'your-secret'];

$verifier = AccessTokenVerifierBuilder::create($issuerMetadata, $clientMetadata)
    ->withJwksProviderBuilder((new JwksProviderBuilder())->withCache($cache)->withCacheTtl(86400))
    ->build();

try {
    $payload = $verifier->verify($jwtToken);
    // Token is valid; proceed with authorization logic.
} catch (InvalidTokenExceptionInterface $e) {
    // Handle invalid token (e.g., log, reject request).
}

Trade-offs:

  • Low Community Activity: Only 4 stars and no dependents, though the package is actively maintained (recent updates for PHP 8.5).
  • Manual Revocation: Requires additional integration for real-time token revocation (e.g., via introspection or a revocation list service).

Recommendation: Pilot this package for OAuth2 flows in [Project X] to validate its performance, security, and ease of integration. If successful, expand its use to API gateways and microservices to centralize JWT validation across the stack. Pair it with a revocation service if real-time revocation is a requirement."*


Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky