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

Ids Sante Bundle Laravel Package

aldaflux/ids-sante-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require aldaflux/ids-sante-bundle:dev-master
    

    Ensure your project uses Symfony 4.0+ and Doctrine Collections.

  2. Enable the Bundle Add to config/bundles.php:

    return [
        // ...
        Aldaflux\IdsSanteBundle\AldafluxIdsSanteBundle::class => ['all' => true],
    ];
    
  3. Configure the Bundle Create config/packages/aldaflux_ids_sante.yaml:

    aldaflux_ids_sante:
        application_name: "YourAppName"
        active: true
        prefixe: "03"  # Default prefix for IDS integration
        user:
            class: "App\Entity\User"  # Replace with your User entity
        soap:
            wsdl:
                log: "http://api.idshost.priv/log.wsdl"  # Replace with your WSDL URL
    
  4. Set Up Routes Add to config/routes/ids_routes.yaml:

    ids_routes:
        resource: "@AldafluxIdsSanteBundle/Resources/config/routing/routes.yml"
    
  5. First Use Case: Test Login Access /ids/checkpasswordservice/test to verify the bundle is working. This endpoint is useful for debugging authentication flows.


Implementation Patterns

Authentication Workflow

  1. User Entity Integration Ensure your User entity implements the required methods (e.g., findOneByUsername). Example:

    // src/Entity/User.php
    namespace App\Entity;
    
    use Doctrine\ORM\Mapping as ORM;
    
    #[ORM\Entity(repositoryClass: "App\Repository\UserRepository")]
    class User
    {
        // ...
        public function findOneByUsername(string $username): ?User
        {
            return $this->getDoctrine()->getRepository(User::class)->findOneBy(['username' => $username]);
        }
    }
    
  2. SOAP Service Integration The bundle uses SOAP for communication with ids.host. Extend or override the SOAP client logic in:

    // src/Service/IdsSoapService.php (custom implementation)
    use Aldaflux\IdsSanteBundle\Service\IdsSoapService as BaseIdsSoapService;
    
    class IdsSoapService extends BaseIdsSoapService
    {
        public function __construct(\SoapClient $client, array $options)
        {
            parent::__construct($client, $options);
            // Custom logic here
        }
    }
    

    Bind the service in services.yaml:

    services:
        Aldaflux\IdsSanteBundle\Service\IdsSoapService: '@app.service.ids_soap'
        app.service.ids_soap:
            class: App\Service\IdsSoapService
            arguments:
                - '@soap.client'
                - { /* options */ }
    
  3. Logging and Debugging Use the /ids/logs endpoint (restricted to ROLE_ADMIN) to inspect authentication logs. Extend the logger if needed:

    // src/Service/IdsLogger.php
    use Aldaflux\IdsSanteBundle\Service\IdsLogger as BaseIdsLogger;
    
    class IdsLogger extends BaseIdsLogger
    {
        public function logEvent(string $event, array $data): void
        {
            // Custom logging logic (e.g., send to external service)
            parent::logEvent($event, $data);
        }
    }
    

Common Use Cases

  1. Password Validation Use the IdsPasswordService to validate user credentials against ids.host:

    use Aldaflux\IdsSanteBundle\Service\IdsPasswordService;
    
    $passwordService = $container->get(IdsPasswordService::class);
    $isValid = $passwordService->validatePassword($username, $password);
    
  2. Proxy Configuration (Dev Only) Enable proxy for local development:

    # config/packages/aldaflux_ids_sante.yaml
    when@dev:
        aldaflux_ids_sante:
            proxy:
                enabled: true
                ip: '%env(IDS_PROXY_IP)%'
    
  3. Event Listeners Subscribe to IDS events (e.g., login failures) in services.yaml:

    services:
        app.listener.ids_auth_failure:
            class: App\EventListener\IdsAuthFailureListener
            tags:
                - { name: kernel.event_listener, event: ids.auth.failure, method: onAuthFailure }
    

Gotchas and Tips

Pitfalls

  1. SOAP WSDL URL

    • Ensure the wsdl.log URL in aldaflux_ids_sante.yaml is correct and accessible. Test with:
      curl http://api.idshost.priv/log.wsdl
      
    • If the WSDL is unreachable, the bundle will throw a SoapFault exception. Handle it gracefully:
      try {
          $client = new \SoapClient($wsdlUrl);
      } catch (\SoapFault $fault) {
          throw new \RuntimeException('IDS SOAP service unavailable. Check WSDL URL.');
      }
      
  2. User Entity Compatibility

    • The bundle assumes your User entity has a findOneByUsername method. If not, override the IdsUserProvider:
      // src/Service/IdsUserProvider.php
      use Aldaflux\IdsSanteBundle\Service\IdsUserProvider as BaseIdsUserProvider;
      
      class IdsUserProvider extends BaseIdsUserProvider
      {
          public function findUserByUsername(string $username): ?User
          {
              return $this->userRepository->findBy(['email' => $username]); // Custom logic
          }
      }
      
  3. Security Restrictions

    • The /ids/logs endpoint requires ROLE_ADMIN. Ensure your security.yaml is configured:
      security:
          access_control:
              - { path: '^/ids/logs', roles: ROLE_ADMIN }
      
    • If using Symfony’s security component, add the role to your admin user:
      $user->addRole('ROLE_ADMIN');
      
  4. Dev Proxy Quirks

    • The proxy feature (IDS_PROXY_ENABLED) is dev-only. Ensure it’s disabled in production:
      # .env
      IDS_PROXY_ENABLED=false
      
    • If enabled, set IDS_PROXY_IP to your local proxy IP (e.g., 127.0.0.1).

Debugging Tips

  1. Enable SOAP Debugging Add to aldaflux_ids_sante.yaml:

    soap:
        debug: true  # Enable SOAP client debugging
    

    Check logs for SOAP request/response details.

  2. Test the Password Service Use the /ids/checkpasswordservice/test endpoint to verify SOAP connectivity:

    curl -X POST http://your-app/ids/checkpasswordservice/test
    

    Expected response: {"success": true} if the service is reachable.

  3. Override Bundle Templates The bundle uses Twig templates in Resources/views/. Override them in your project:

    templates/
        bundles/
            AldafluxIdsSante/
                base.html.twig  # Override base template
    
  4. Environment-Specific Config Use Symfony’s parameter system for environment-specific settings:

    # config/packages/aldaflux_ids_sante.yaml
    aldaflux_ids_sante:
        soap:
            wsdl:
                log: '%env(IDS_WSDL_LOG_URL)%'
    

    Set in .env:

    IDS_WSDL_LOG_URL=https://prod.idshost.priv/log.wsdl
    

Extension Points

  1. Custom SOAP Client Replace the default SOAP client by binding your own service:

    services:
        soap.client:
            class: \SoapClient
            arguments:
                - '%env(IDS_WSDL_URL)%'
                - { trace: true, exceptions: true }
    
  2. Event Dispatching The bundle dispatches events like ids.auth.success and ids.auth.failure. Listen to them:

    services:
        app.listener.ids_auth:
            class: App\EventListener\IdsAuthListener
            tags:
                - { name: kernel.event_listener, event: ids.auth.success, method: onAuthSuccess }
    
  3. Logging Customization Extend the IdsLogger to add custom logging (e.g., to a SIEM):

    class CustomIdsLogger extends IdsLogger
    {
        public function logEvent(string $event, array $data): void
        {
            // Send to external logging service
            $this->externalLogger->log($event, $data);
            parent::logEvent($event, $data); // Fallback to default
        }
    }
    

4

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.
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
atriumphp/atrium