Weave 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

Jwtauthroles Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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.

  • Maintenance signal remains poor, marginally better than recorded. The 1.3.1 bump supersedes the "single release in February 2023" observation: there is now evidence of continued, if infrequent, maintenance. But 15 stars, zero dependents, an agency maintainer extracting an internal tool, no visible CI matrix, and no security disclosure process are unchanged. A terse, changelog-free release note is not a governance improvement.
  • Scope of this release is narrow and low-signal. "Added laravel 9|10 support" reads as a composer constraint widening, not an auth-path change. Treat it as a green light to re-run the spike, not as a reason to defer the security review.
  • JWT validation is where subtle defects become auth bypasses. The items to audit are unchanged and non-negotiable: algorithm allow-listing (RS256 only — no none, no HS256 confusion), kid header handling, validation of iss/aud/exp/nbf with explicit clock leeway, and JWKS caching and refresh semantics.
  • Laravel lifecycle drift is now the clearer gap. With 9/10 declared, Laravel 11 and 12 remain unsupported by the package's own constraint. Without CI coverage, expect to pin versions or maintain a patch.

Key questions to resolve before committing.

  1. Is the 9/10 support a constraint widening only, or does it carry code changes to the provider/guard registration path?
  2. Does a CI matrix actually exercise Laravel 9 and 10, or is the constraint declared without test coverage?
  3. Which JWT library is used underneath, and does it enforce a single permitted algorithm?
  4. Are JWKS keys cached, with what TTL, and what is the behavior on a kid cache miss?
  5. Are aud and iss validated, or is only the signature checked?
  6. How are roles surfaced — Gate abilities, a trait on the user model, or a raw claim array?
  7. Does it persist users to Eloquent or hydrate purely from claims, and does it handle first-login provisioning?
  8. Does the suite exercise the JWKS path offline?

Integration Approach

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:

  • Greenfield API: install as the driver for a stateless api guard, retaining the web session guard for any Blade or admin surface. Cleanest and lowest risk.
  • Replacing existing auth: register the package behind our own named guard in 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.

  1. Re-run the spike against a FusionAuth dev tenant on the now-supported 9/10 path: token issuance → guard → role check end to end (1–2 days).
  2. Security review of the validation path (algorithm pinning, aud/iss, JWKS caching). Still a gate, not a formality — 1.3.1 gives us no reason to shorten it.
  3. Wrap behind our own guard/provider aliases; write integration tests using a fixed test key so CI never hits the network.
  4. Rehearse key rotation in staging: rotate the signing key, confirm no auth outage.
  5. Only then promote to a production guard.

Operational Impact

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.

  • JWKS endpoint unreachable with a cold cache → total authentication outage. Mitigate with cache pre-warm and stale-key fallback.
  • Key rotation without cache refresh → mass 401s until invalidation.
  • Role staleness: roles are baked into the token, so a revoked role persists until expiry. Requires short access-token TTLs with refresh, or an explicit, documented revocation-lag decision — a product tradeoff, not just a technical one.
  • Clock skew between FusionAuth and app servers → spurious nbf/exp rejections. Set explicit leeway.
  • Algorithm downgrade if validation is not strict → security incident, the worst-case branch of this entire evaluation.

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.

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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle