werk365/jwtauthroles
A Laravel package that combines JSON Web Token authentication with role-based access control, letting you issue JWTs and restrict routes or actions by user role. A lightweight option for adding token auth and simple role checks to existing Laravel apps.
Architecture fit. Unchanged. The package is a Laravel-native auth guard plus user provider, so it plugs into the framework's existing config/auth.php guard/provider model and Auth::extend seam rather than requiring bespoke middleware. That is the correct architectural insertion point and keeps it composable with Laravel's Gate/Policy authorization layer. Scope remains narrow by design: authenticate a FusionAuth-issued JWT and expose FusionAuth roles to Laravel's authorization system. It fits only if FusionAuth is the identity provider decision — it is not an IdP-agnostic solution.
Integration feasibility. Low effort for a spike, and now lower-risk on one axis. Release 1.3.1 explicitly declares laravel 9|10 support, which converts our prior assumption about framework compatibility into a stated constraint. That removes the "does it even install?" question from the spike and lets day one go to token issuance → guard → role check rather than composer conflict resolution. Composer install, publish config, register a guard driver, and point it at either a static PEM or the JWKS endpoint; a senior Laravel developer still reaches a working proof of concept in about a day. The JWKS option remains the operationally correct choice over PEM because it accommodates signing-key rotation.
Technical risk. Still high relative to how critical the code path is — the release does not change this.
none, no HS256 confusion), kid header handling, validation of iss/aud/exp/nbf with explicit clock leeway, and JWKS caching and refresh semantics.Key questions to resolve before committing.
kid cache miss?aud and iss validated, or is only the signature checked?Stack fit. The safe zone is now explicitly Laravel 9/10 on PHP 8.1/8.2, per the package's own constraint. Confirm against our actual runtime matrix; do not infer forward compatibility to Laravel 11/12 — the release note draws that boundary rather than removing it.
Migration path. Two viable shapes, unchanged:
api guard, retaining the web session guard for any Blade or admin surface. Cleanest and lowest risk.AuthServiceProvider so call sites depend on the guard name, never on the package namespace. That insulation remains the single most important integration decision — it means swapping in roughly 150 lines of firebase/php-jwt plus a cached JWKS fetcher requires zero call-site changes.Compatibility. Pin exact versions rather than taking a floating ^ constraint on an unmaintained auth dependency. The 1.3.1 release is a live illustration of why: a minor bump that only touches framework constraints is exactly the kind of change that can silently alter resolution across our app. Keep it on the dependency-review list with a recorded exit criterion and a named owner.
Sequencing.
aud/iss, JWKS caching). Still a gate, not a formality — 1.3.1 gives us no reason to shorten it.Maintenance. Assume we own the code. Treat the package as a well-shaped reference implementation rather than a dependency we consume indefinitely. The 1.3.1 release is a mild positive — the maintainer is still shipping — but at this cadence it does not change the conclusion: budget a fork-or-vendor decision at the six-month review, or immediately if a Laravel major lands (Laravel 11/12 support is not claimed and is unlikely to arrive quickly). MIT licensing makes forking legally clean, and the small surface area makes it technically cheap.
Support. GitHub issues only, no SLA, single-organization maintainer, no visible security disclosure channel. For a component on the authentication hot path, this remains the weakest element in the entire assessment and should be stated plainly to stakeholders rather than buried in a dependency list.
Scaling. Stateless verification scales well horizontally: no session store, and no per-request database lookup if the user is hydrated from claims. The bottleneck and the risk is the JWKS fetch. It must be cached (in-process or Redis) with kid-keyed fallback, or every cold request becomes an outbound HTTP dependency on FusionAuth availability. Verify there is no synchronous JWKS call on the request path.
Failure modes, ranked by blast radius.
nbf/exp rejections. Set explicit leeway.Ramp-up. Small API surface and one config file; a Laravel developer is productive inside a day. The real learning cost is FusionAuth itself — tenants, applications, roles, key management — which the package does nothing to reduce.
Bottom line. 1.3.1 is a maintenance release that confirms Laravel 9/10 compatibility and removes an open integration unknown; it does not alter the risk profile of the token-validation path or the support posture. The recommendation stands unchanged: viable and cheap to integrate, but adopt only with three conditions — a completed security review of the token-validation path, a guard-name abstraction that renders the package replaceable, and a funded fork plan. Without all three, the maintenance profile of an authentication dependency at 15 stars is not a risk worth accepting.
How can I help you explore Laravel packages today?