alcalyn/symfony-wsse

WSSE implementation based on Symfony examples in documentation.

1.1.0 2017-09-26 15:34 UTC

This package is not auto-updated.

Last update: 2024-11-09 18:22:16 UTC


README

This library provide classes used in Symfony documentation, about a WSSE implementation.

Installation

Via Composer

{
    "require": {
        "alcalyn/symfony-wsse": "~1.0.0"
    }
}

Usage

You have to register library class in your Symfony project.

Silex

See SilexWSSE project.

Symfony full stack

Following Symfony2 documentation about WSSE:

Register services:

# app/config/services.yml
services:
    wsse.security.authentication.provider:
        class: Alcalyn\Wsse\Security\Authentication\Provider\WsseProvider
        arguments:
            - "" # User Provider
            - "%kernel.cache_dir%/security/nonces"
        public: false

    wsse.security.authentication.listener:
        class: Alcalyn\Wsse\Security\Firewall\WsseListener
        arguments: ["@security.token_storage", "@security.authentication.manager"]
        public: false

Register your WSSE security context:

// src/AppBundle/AppBundle.php
namespace AppBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Alcalyn\Wsse\DependencyInjection\Security\Factory\WsseFactory;

class AppBundle extends Bundle
{
    public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $extension = $container->getExtension('security');
        $extension->addSecurityListenerFactory(new WsseFactory());
    }
}

Now you can use WSSE security in your project:

# app/config/security.yml
security:
    # ...

    firewalls:
        wsse_secured:
            pattern:   ^/api/
            stateless: true
            wsse:      true

License

This project is under MIT License.