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

Oneloginsaml Bundle Laravel Package

ae/oneloginsaml-bundle

Symfony bundle wrapping OneLogin’s PHP SAML toolkit to add SAML 2.0 SSO/SLO to your app. Configure IdP/SP metadata via YAML, expose ACS/logout/metadata endpoints, and integrate with Symfony security firewalls for authentication flows.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • SAML Integration: The bundle leverages the widely adopted onelogin/php-saml library, ensuring compatibility with standard SAML 2.0 protocols. This aligns well with Symfony-based applications requiring Identity Provider (IdP) integration (e.g., OneLogin, Okta, Azure AD).
  • Bundle-Based Design: The Symfony bundle pattern is familiar to Laravel developers via bridges (e.g., symfony/console, symfony/http-foundation), but Laravel lacks native bundle support. A wrapper or facade layer would be required to abstract Symfony-specific components (e.g., AppKernel, YAML config).
  • Stateful Authentication: SAML’s reliance on session state and redirects contrasts with Laravel’s stateless middleware paradigm. A custom middleware pipeline or Lumen/Symfony hybrid may be needed to manage SAML flows (e.g., ACS, SLO).

Integration Feasibility

  • Core Dependencies:
    • onelogin/php-saml (PHP 7.2+ compatible) is mature but requires PHP extensions (openssl, curl, mbstring).
    • Symfony components (HttpFoundation, DependencyInjection) can be polyfilled in Laravel via symfony/http-client or symfony/dependency-injection.
  • Key Challenges:
    • Configuration Management: YAML-based config in Symfony vs. Laravel’s PHP/ENV files. A config transformer (e.g., YAML → .env) would simplify adoption.
    • Routing: Symfony’s routing.yml vs. Laravel’s routes/web.php. SAML endpoints (ACS, SLO) would need manual route registration.
    • Event System: Symfony’s event dispatcher (EventDispatcherInterface) is absent in Laravel. A custom event bus or laravel-events package could bridge this gap.

Technical Risk

  • High:
    • Legacy Codebase: Last release in 2019 (5+ years stale). Risk of compatibility issues with modern PHP (8.1+) or Symfony (6.x) dependencies.
    • Laravel-Symfony Friction: No native Laravel support; requires significant abstraction work.
    • Security: SAML misconfigurations (e.g., certificate validation, binding mismatches) could expose vulnerabilities. Rigorous testing of ACS/SLO flows is critical.
  • Mitigation:
    • Fork and Modernize: Update the bundle to target Symfony 5/6 and PHP 8.1+, then adapt for Laravel.
    • Isolation: Containerize the SAML logic (e.g., a microservice) to limit blast radius.
    • Fallback: Evaluate alternatives like shibboleth/sp or onelogin/php-saml directly with a Laravel wrapper.

Key Questions

  1. Why Symfony-Specific?
    • Is the bundle’s Symfony dependency non-negotiable, or can core SAML logic be extracted?
  2. Laravel Compatibility Gaps:
    • How will Symfony’s Container/EventDispatcher integrate with Laravel’s ServiceProvider/Events?
  3. Maintenance Burden:
    • Who will handle security updates for the underlying onelogin/php-saml library?
  4. Performance:
    • Will SAML’s session-heavy flows conflict with Laravel’s stateless design?
  5. Alternatives:
    • Are there Laravel-native SAML packages (e.g., janitzio/laravel-saml) with lower integration risk?

Integration Approach

Stack Fit

  • Target Stack:
    • Laravel 9+ (PHP 8.1+) with:
      • symfony/http-client (for HTTP bindings).
      • symfony/dependency-injection (for config management).
      • spatie/laravel-ignition (for error handling during SAML flows).
    • Alternate: Use onelogin/php-saml directly with a custom Laravel facade.
  • Non-Fit:
    • Avoid if the team lacks Symfony/Laravel hybrid experience.
    • Poor fit for headless APIs (SAML’s session state complicates stateless architectures).

Migration Path

  1. Assessment Phase:
    • Audit current auth flow (e.g., OAuth2 vs. SAML requirements).
    • Benchmark alternatives (e.g., janitzio/laravel-saml, league/oauth2-server).
  2. Proof of Concept:
    • Fork the bundle, replace Symfony dependencies with Laravel equivalents.
    • Test ACS/SLO endpoints in a staging environment.
  3. Incremental Rollout:
    • Phase 1: Implement IdP-initiated SAML (SSO) with minimal routing changes.
    • Phase 2: Add SP-initiated flows and SLO.
    • Phase 3: Integrate with Laravel’s auth system (e.g., Auth::loginUsingId($samlUser)).

Compatibility

  • Symfony → Laravel Mappings:
    Symfony Component Laravel Equivalent Notes
    AppKernel ServiceProvider Register bundle via register()
    routing.yml routes/web.php Manual route definitions for /saml/*
    EventDispatcher Illuminate\Events\Dispatcher Use event(new \Symfony\Event\...)
    YAML Config .env + config/services.php Transform YAML to Laravel config
  • Critical Dependencies:
    • onelogin/php-saml must support PHP 8.1+ (check for strict_types compatibility).
    • Laravel’s session driver must support SAML’s session storage (e.g., file or database).

Sequencing

  1. Pre-requisites:
    • Upgrade PHP to 8.1+ and enable required extensions (openssl, curl).
    • Set up a test IdP (e.g., OneLogin sandbox) for SAML validation.
  2. Core Integration:
    • Replace Symfony bundle with a Laravel ServiceProvider wrapping onelogin/php-saml.
    • Implement middleware for SAML-aware routes (e.g., SamlMiddleware).
  3. Post-Integration:
    • Test edge cases (e.g., failed logouts, malformed assertions).
    • Monitor performance under load (SAML’s XML parsing can be CPU-intensive).

Operational Impact

Maintenance

  • Ongoing Efforts:
    • Security Patches: Monitor onelogin/php-saml for CVEs (e.g., SAML signature validation flaws). Plan quarterly updates.
    • Configuration Drift: SAML metadata (e.g., entityId, certificates) may change. Automate validation via CI (e.g., php-saml’s validateMetadata).
    • Dependency Hell: Symfony components may introduce breaking changes. Use composer’s platform-check to enforce PHP/Laravel version alignment.
  • Tooling:
    • Logging: Instrument SAML events (e.g., saml.auth.attempt, saml.logout.failed) using Laravel’s Log facade.
    • Monitoring: Track SAML-specific metrics (e.g., ACS response time, SLO success rate) with Prometheus or Datadog.

Support

  • Troubleshooting:
    • Common Issues:
      • Certificate errors: Validate x509cert in config and IdP metadata.
      • Redirect loops: Check AssertionConsumerService URL bindings (HTTP-POST vs. HTTP-Redirect).
      • Session conflicts: Ensure Laravel’s session driver persists across SAML redirects.
    • Debugging Tools:
      • Use onelogin/php-saml’s debugEnable for verbose logging.
      • Capture SAML request/response payloads with a proxy (e.g., Charles Proxy).
  • Escalation Path:
    • For onelogin/php-saml issues, engage the community via GitHub issues or OneLogin support (if using their IdP).

Scaling

  • Performance Bottlenecks:
    • XML Parsing: SAML assertions are XML-heavy. Optimize with SimpleXML or ExtXML extensions.
    • Session Storage: Distributed sessions (e.g., Redis) may introduce latency for SAML state.
    • Load Testing: Simulate high-concurrency SSO with tools like Locust, focusing on ACS endpoint.
  • Horizontal Scaling:
    • SAML’s session state complicates stateless scaling. Consider:
      • Sticky sessions (if using a load balancer like Nginx).
      • Externalizing SAML state to a shared cache (e.g., Redis).

Failure Modes

Failure Scenario Impact Mitigation Strategy
IdP Unavailable Users blocked from SSO Implement fallback auth (e.g., local DB login).
Certificate Expiry SAML validation fails Automate certificate renewal alerts.
Malformed SAML Response Security vulnerability Validate assertions server-side (e.g., spverify in onelogin/php-saml).
Session Timeout During SAML
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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle