How novactive/almaviacxibexasamlbundle works
Project Type and Purpose
• This is a Symfony-based bundle (a plugin/module) that adds SAML authentication support to Ibexa.
• The bundle handles SAML configuration, dependency injection, view customization, and authentication logic by connecting with an external SAML Identity Provider (IdP).
File Structure
• Top-level files (LICENSE, README.md, composer.json, ci-config.yaml) indicate this is a well-packaged, deployable library.
• The “src” directory is split into two main sections:
• The “bundle” folder encapsulates the Symfony bundle itself. It contains:
▪ The main bundle PHP class (AlmaviaCXIbexaSamlBundle.php).
▪ A DependencyInjection subdirectory with extension classes (e.g., AlmaviaCXIbexaSamlExtension.php) and a Compiler folder (LazySaml2Auth.php). These facilitate service registration and custom compilation passes.
▪ A Resources directory for configuration (YAML files such as default_settings.yaml, services.yaml), translations, and Twig view templates for the admin login interface.
• The “lib” folder holds the core business logic under Security/Saml:
▪ SamlAuthFactory, SamlUserFactory, SamlUserProvider, and related classes handling low-level SAML operations, error handling (SamlException, SamlExceptionLogger), and user creation/mapping.
Key Components
• SAML Bundle – Represents the high-level integration into the Ibexa project.
• Integration into Symfony’s Dependency Injection container (via the Extension and Compiler classes).
• How YAML configuration files (default_settings.yaml, services.yaml, monolog.yaml, etc.) are processed.
• SAML Library – The “lib” directory with classes handling:
• Authentication factory (SamlAuthFactory)
• User provider and factory for creating or loading users based on SAML assertions.
• Exception handling and logging specific to SAML operations.
• SAML IdP configuration (entityId, login/logout URLs, bindings, X509 Certificate, email attribute).
• SAML Service Provider (SP) settings.
• External SAML Identity Provider (IdP) – Represent the external SAML service that the bundle communicates with.
• Ibexa Application / Security Layer – Show the integration where the bundle’s configuration modifies the security firewall and routes (like /saml/login, /saml/acs, /saml/logout) in the Ibexa application.
Relationships and Interactions
• Data flow: From the configuration files/environment variables into the Dependency Injection process.
• The SAML Bundle’s registration of services via DependencyInjection and Compiler passes.
• How SAML authentication requests and responses are handled by the SamlAuthFactory and routed controllers.
• The SAML User Provider’s role in mapping SAML attributes to Ibexa users.
• Communication between the Ibexa application’s UI (admin login page utilizing the Twig template) and the SAML endpoints.
• The flow of authentication data between the SAML Service Provider (your bundle) and the external IdP.
Specific Architectural Patterns / Principles
• Dependency Injection – Evident from the DI directory and compiler passes.
• Configuration-Driven Behavior – YAML configuration and environment variables drive the behavior of the authentication logic.
• Separation of Concerns – The division between the “bundle” (integration with Symfony and Ibexa) and “lib” (pure SAML logic/security services) is an important architectural separation.