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

Laravel Keycloak Guard Laravel Package

robsontenorio/laravel-keycloak-guard

Laravel Keycloak Guard provides a Keycloak authentication guard for Laravel, validating JWT access tokens and exposing roles and permissions. It integrates with Laravel's native auth system, making it easy to protect routes and APIs with Keycloak-issued tokens.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for SSO/identity: laravel-keycloak-guard lets a Laravel app delegate authentication to an existing Keycloak realm instead of building OIDC/SAML integration and token validation in-house. This is a buy/borrow decision that trades control for speed — relevant whenever an enterprise customer or internal IT standardizes on Keycloak.
  • Enterprise/self-hosted auth roadmap: Supports sequencing decisions like "ship Keycloak SSO before SOC 2 / procurement blockers" versus building native social login or passwordless first. If your buyer's IT team already runs Keycloak, this package can collapse a multi-sprint integration into days.
  • Which customer segments you can serve: Keycloak is common in EU public sector, healthcare, and enterprises with self-hosted identity requirements. Adopting this package unlocks those deals; not adopting it caps you at customers who accept your own auth or a SaaS IdP.
  • 2.0.1 specifically — UUID subject identifiers: The release fixes the guard's id() so it supports string/UUID identifiers instead of assuming integer-like IDs. Product implication: Keycloak realms configured with UUID user IDs (the default in many modern realms) previously broke or misbehaved on login. If any target account uses default Keycloak realm settings, 2.0.0 was effectively unusable and 2.0.1 is the first viable version. Any pilot planned on 2.0.0 should be re-baselined to 2.0.1 before you draw conclusions about fit.
  • Support and reliability commitments: This is a patch on a just-released major (2.0.0 → 2.0.1 within days), which is a signal to plan a pinning and upgrade-review policy rather than "set and forget." It informs whether you promise customers "SSO supported" with an SLA or offer it as best-effort.

When to Consider This Package

Consider it when:

  • Keycloak is a stated requirement — a prospect, parent company, or your own platform team already operates Keycloak and wants your Laravel app to be a relying party, not an identity provider.
  • You need token validation and role mapping, not just login redirect — the guard's value is authenticating requests against Keycloak-issued tokens and exposing roles/claims to Laravel's auth layer, which is the tedious part to hand-roll.
  • You are on a supported Laravel/PHP version and can pin the dependency — you need to verify compatibility against your Laravel major and PHP version, and be willing to lock the version and review changelogs on upgrade.
  • Your team lacks OIDC/security depth — if nobody wants to own JWKS caching, key rotation, clock skew, and claim validation, delegating to a maintained package is the lower-risk path.
  • You want to prototype SSO quickly for a pilot or design partner — this is a fast way to validate a Keycloak-heavy deal before committing to a long-term architecture.

Look elsewhere when:

  • You need a vendor with a support contract, security disclosure process, and SLA. This is community-maintained; you are accepting maintainer-availability risk. If procurement requires a supported dependency, budget for a commercial IdP or in-house OIDC implementation.
  • You need multi-IdP or B2C-scale identity — mixing Keycloak with social login, MFA policy per tenant, or hundreds of thousands of consumer accounts is beyond a guard's scope; use a dedicated IdP or Laravel's first-party auth starter kits plus a vetted OIDC library.
  • You are mid-migration off Keycloak — don't deepen the coupling.
  • You cannot accept a young major version. 2.0.x is days old and just corrected a UUID assumption; if your release train can't tolerate a fast-follow patch, wait for 2.0.x to stabilize or stay on the prior line if it meets your needs.
  • Your identifiers are non-standard or heavily customized — the 2.0.1 fix covers UUIDs, but unusual subject-claim mappings or custom Keycloak mappers still warrant a spike before you commit.

How to Pitch It (Stakeholders)

For executives: This is a small, focused library that lets our Laravel application accept logins from a customer's existing Keycloak identity system. The commercial case is deal enablement: enterprise and public-sector buyers frequently mandate their own identity provider, and "we support Keycloak SSO" removes a common procurement blocker without us building and securing an SSO stack ourselves. The 2.0.1 release fixes a real defect — logins failed for Keycloak realms using UUID user identifiers, which is the default in modern setups — so it materially widens the set of customers we can actually serve. The trade-off is dependency risk: it is community-maintained, so we should pin the version, track releases, and treat SSO as "supported" only once we have a tested integration and a fallback plan.

For engineering: Adopt at a pinned 2.0.1 (not 2.0.0 — its id() assumed integer-like identifiers and breaks on UUID subjects). Scope is guard-level authentication against Keycloak tokens with role/claim access through Laravel's auth layer, so we get token validation and role mapping without hand-rolling JWKS handling and key rotation. Action items: run a spike against our actual Keycloak realm configuration (UUID vs. legacy IDs), confirm Laravel/PHP version compatibility, add integration tests around login and role checks so future upstream patches are cheap to evaluate, and add a dependency-review step to our upgrade cadence given the rapid 2.0.0 → 2.0.1 follow-up. If we need multi-IdP, per-tenant MFA policy, or a supported vendor contract, this package is the wrong layer and we should revisit the architecture rather than extend it.

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.
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo