All Projects → djoos → Escapewsseauthenticationbundle

djoos / Escapewsseauthenticationbundle

Symfony bundle to implement WSSE authentication

Labels

Projects that are alternatives of or similar to Escapewsseauthenticationbundle

Passwordstrengthbundle
Symfony Password strength and blacklisting validator bundle
Stars: ✭ 123 (-10.87%)
Mutual labels:  symfony
Property Info
PropertyInfo extracts information about PHP class' properties using metadata of popular sources.
Stars: ✭ 1,747 (+1165.94%)
Mutual labels:  symfony
Stofdoctrineextensionsbundle
Integration bundle for DoctrineExtensions by l3pp4rd in Symfony
Stars: ✭ 1,713 (+1141.3%)
Mutual labels:  symfony
Rss Atom Bundle
RSS and Atom Bundle for Symfony
Stars: ✭ 123 (-10.87%)
Mutual labels:  symfony
Routing Bundle
Integrate the CMF Routing component as a Symfony2 bundle: Have the chain router and the dynamic router available in Symfony2
Stars: ✭ 124 (-10.14%)
Mutual labels:  symfony
Jsformvalidatorbundle
The Javascript validation for Symfony 2, 3 and 4 forms
Stars: ✭ 130 (-5.8%)
Mutual labels:  symfony
Swiftmailer Bundle
Symfony Swiftmailer Bundle
Stars: ✭ 1,558 (+1028.99%)
Mutual labels:  symfony
Service Contracts
A set of service abstractions extracted out of the Symfony components
Stars: ✭ 1,931 (+1299.28%)
Mutual labels:  symfony
Symfony4 Ddd
Bootstrap Application for Symfony 4 with Domain Driven Design
Stars: ✭ 126 (-8.7%)
Mutual labels:  symfony
Server For Symfony Flex
A self hosted server for Symfony Flex allowing private and customized recipes, proxy and caching functionality for the official endpoints.
Stars: ✭ 132 (-4.35%)
Mutual labels:  symfony
Liformbundle
Symfony Bundle to render Symfony Forms to JSON Schema
Stars: ✭ 124 (-10.14%)
Mutual labels:  symfony
Php Ddd Example
🐘🎯 Hexagonal Architecture + DDD + CQRS in PHP using Symfony 5
Stars: ✭ 1,960 (+1320.29%)
Mutual labels:  symfony
Feedbundle
A Symfony bundle to build RSS feeds from your entities
Stars: ✭ 130 (-5.8%)
Mutual labels:  symfony
Backup Manager
Database backup manager for dumping to and restoring databases from S3, Dropbox, FTP, SFTP, and Rackspace Cloud
Stars: ✭ 1,589 (+1051.45%)
Mutual labels:  symfony
Symfony Bridge
[READ ONLY] Bridge for using command buses and event buses in Symfony projects. Full documentation can be found here:
Stars: ✭ 133 (-3.62%)
Mutual labels:  symfony
Symfony Demo App
A Symfony demo application with basic user management
Stars: ✭ 122 (-11.59%)
Mutual labels:  symfony
Wouterjeloquentbundle
Integrates the Eloquent ORM in the Symfony framework
Stars: ✭ 126 (-8.7%)
Mutual labels:  symfony
Sonatanotificationbundle
Symfony SonataNotificationBundle
Stars: ✭ 136 (-1.45%)
Mutual labels:  symfony
Jobeet Tutorial
📖 Symfony 4.2 Jobeet Tutorial
Stars: ✭ 134 (-2.9%)
Mutual labels:  symfony
Doctrinephpcrbundle
This bundle integrates Doctrine PHPCR ODM and PHPCR backends into Symfony
Stars: ✭ 131 (-5.07%)
Mutual labels:  symfony

Build Status

Introduction

The EscapeWSSEAuthentication bundle is a simple and easy way to implement WSSE authentication in Symfony applications

Installation

Command Line

composer require escapestudios/wsse-authentication-bundle

composer.json

"require": {
    ...
    "escapestudios/wsse-authentication-bundle": "^2.2",
    ...
}

app/AppKernel.php

public function registerBundles()
{
    return array(
        //...
        new Escape\WSSEAuthenticationBundle\EscapeWSSEAuthenticationBundle(),
        //...
    );
    ...

Commands

Delete expired nonces via the escape:wsseauthentication:nonces:delete command that ships with this bundle; it takes the firewall name as a (required) parameter.

php app/console --env=dev escape:wsseauthentication:nonces:delete wsse_secured

Quick usage example

app/config/security.yml

firewalls:
    wsse_secured:
        pattern:   ^/api/.*
        stateless: true
        wsse:
            realm: "Secured with WSSE" #identifies the set of resources to which the authentication information will apply (WWW-Authenticate)
            profile: "UsernameToken" #WSSE profile (WWW-Authenticate)

...that's it! Your "wsse_secured"-firewall is now secured via the (out-of-the-box) WSSE Authentication setup. You can now start calling your API endpoints: generate a X-WSSE header (Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder) and add it to your request (cUrl). It is strongly recommended to have a read through the more advanced configuration below once you're up and running with the basics...

Advanced configuration

Specify a custom token lifetime

Default value: 300

app/config/security.yml

firewalls:
    wsse_secured:
        #...
        wsse:
            #...
            lifetime: 300 # or -1 for infinite lifetime tokens (please use with extreme care!)

Specify a custom date format

Default value: see regular expression below for ISO8601 (check out)

app/config/security.yml

firewalls:
    wsse_secured:
        #...
        wsse:
            #...
            date_format: '/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/'

Specify a custom digest algorithm

Default value: base 64-encoded sha1 with 1 iteration

⚠️ Please change the digest algorithm to a stronger one, like bcrypt ⚠️

app/config/security.yml

firewalls:
    wsse_secured:
        #...
        wsse:
            #...
            encoder: #digest algorithm
                algorithm: sha1
                encodeHashAsBase64: true
                iterations: 1

Specify a custom nonce cache

Default value: Doctrine\Common\Cache\PhpFileCache in %kernel.cache_dir%/security/nonces

app/config/security.yml

services:
    #...
    cache_nonces:
        class: Doctrine\Common\Cache\PhpFileCache
        arguments: [%kernel.cache_dir%/security/nonces]

app/config/security.yml

firewalls:
    wsse_secured:
        #...
        wsse:
            #...
            nonce_cache_service_id: cache_nonces

Use multiple providers

app/config/security.yml

providers:
    provider_one:
        #...
    provider_two:
        #...

firewalls:
    wsse_secured_by_provider_one:
        provider: provider_one
        wsse:
            #...

    wsse_secured_by_provider_two:
        provider: provider_two
        wsse:
            #...

Make use of a specific user provider on a firewall with WSSE as one of multiple authentication mechanisms

app/config/security.yml

providers:
    users:
        #...
    wsse_users:
        memory:
            users:
                - { name: 'someuser', password: 'somesecret' }

firewalls:
    secured:
        provider: users
        wsse:
            #...
            provider: wsse_users #don't make use of firewall's "users"-provider, but "wsse_users"-provider for WSSE

Specify custom authentication class(es)

app/config/config.yml

# Escape WSSE authentication configuration
escape_wsse_authentication:
    authentication_provider_class: Escape\WSSEAuthenticationBundle\Security\Core\Authentication\Provider\Provider
    authentication_listener_class: Escape\WSSEAuthenticationBundle\Security\Http\Firewall\Listener
    authentication_entry_point_class: Escape\WSSEAuthenticationBundle\Security\Http\EntryPoint\EntryPoint
    authentication_encoder_class: Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].