PHPackages                             simplesso/common-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. simplesso/common-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

simplesso/common-bundle
=======================

Bundle providing common tools for SimpleSSO server and for Symfony clients.

v1.0.7(7y ago)061MITPHPPHP ^7.1.3

Since Mar 19Pushed 7y ago1 watchersCompare

[ Source](https://github.com/OpenSimpleSSO/CommonBundle)[ Packagist](https://packagist.org/packages/simplesso/common-bundle)[ RSS](/packages/simplesso-common-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (8)Dependencies (4)Versions (9)Used By (0)

SimpleSSO CommonBundle
======================

[](#simplesso-commonbundle)

A bundle with common tools for the SimpleSSO server and for any Symfony client.

Installation
------------

[](#installation)

Add the bundle to your Symfony project with composer.

```
composer require simplesso/common-bundle
```

Configuration
-------------

[](#configuration)

The bundle provide several models that will help you to communicate with the SimpleSSO server. By default, the bundle do not declare any service. It let you choose the services you want. This documentation will show you the whole configuration. You can then adapt it to fit your needs.

### The Guard Authenticator

[](#the-guard-authenticator)

The bundle provide a guard that will authenticate the user against the SimpleSSO server.

First, create the `config/packages/simplesso_common.yaml` file and put the following content:

```
# config/packages/simplesso_common.yaml

services:
    _defaults:
        autowire: true
        autoconfigure: true
        public: false

    SimpleSSO\CommonBundle\:
        resource: '../../vendor/simplesso/common-bundle/src/*'
        exclude: '../../vendor/simplesso/common-bundle/src/{Event,Exception,Model/Data}'

    SimpleSSO\CommonBundle\Model\AuthServerModel:
        $host: '%env(SIMPLESSO_SERVER_HOST)%'
        $publicKey: '%env(file:SIMPLESSO_SERVER_PUBLIC_KEY_PATH)%'
        $clientId: '%env(SIMPLESSO_CLIENT_ID)%'

    SimpleSSO\CommonBundle\Model\OpenSslModel:
        $privateKeyFilePath: '%env(SIMPLESSO_CLIENT_PRIVATE_KEY_PATH)%'
        $publicKeyFilePath: '%env(SIMPLESSO_CLIENT_PUBLIC_KEY_PATH)%'

    SimpleSSO\CommonBundle\Security\LogoutSuccessHandler: ~

    # If you use Twig.
    SimpleSSO\CommonBundle\Twig\Extension: ~
```

As you can see, the services require that you set several environment variables. In development, you can add the following lines to your .env file.

```
SIMPLESSO_SERVER_HOST=https://auth.example.com
SIMPLESSO_SERVER_PUBLIC_KEY_PATH=/path/to/server-public-key.pem
SIMPLESSO_CLIENT_ID=00000000-0000-0000-0000-000000000000
SIMPLESSO_CLIENT_PUBLIC_KEY_PATH=/path/to/client-public-key.pem
SIMPLESSO_CLIENT_PRIVATE_KEY_PATH=/path/to/client-private-key.pem

```

Note that you can get the SimpleSSO server public key by opening `https://auth.example.com/public-key` in a browser or with curl. Securing public keys or the client id is not necessary. However, a real care must be taken with the client private key. The file containing the private key must be readable by the application.

Then, you'll need to configure your security.

```
# config/packages/security.yaml

security:
    providers:
        # ...

    firewalls:
        main:
            anonymous: true
            provider: # ...
            guard:
                authenticators:
                    - SimpleSSO\CommonBundle\Security\AuthTokenAuthenticator
            logout:
                success_handler: SimpleSSO\CommonBundle\Security\LogoutSuccessHandler
```

### The authentication routes

[](#the-authentication-routes)

A fallback route must be configured. The SimpleSSO server will redirect the user to this route with an **AuthToken**. For now, you cannot choose the route you want: it must be `/authenticate`. A logout route must also be set. It can be whatever you want.

Tag the controller provided with the bundle.

```
# config/packages/simplesso_common.yaml

services:
    # ...

    SimpleSSO\CommonBundle\Controller\AuthenticationController:
        tags: [ 'controller.service_arguments' ]
```

Add an access control to your security configuration.

```
# config/packages/security.yaml

security:
    firewalls:
        main: # Your firewall must be named "main".
            # ...

    access_control:
        - { path: ^/authenticate, roles: ROLE_USER }
```

Add the route to the routing. Create the file `config/routes/simplesso_common.yaml` with the following content:

```
# config/routes/simplesso_common.yaml

authentication:
    path: /authenticate
    controller: SimpleSSO\CommonBundle\Controller\AuthenticationController::authenticate

logout:
    path: /logout
    controller: SimpleSSO\CommonBundle\Controller\AuthenticationController::logout
```

### User and User provider

[](#user-and-user-provider)

The way you store the users is completely up to you. You need to provide a user provider that will fetch the user using the id of the user. This mean you have to keep this id (which is an UUID) stored so you can fetch users authenticating.

If the user is not found by the user provider, a `authentication.unknownUserAuthenticated` event is thrown, giving you the possibility to create the user and return it to the authentication system (check `SimpleSSO\CommoneBundle\Event\UserEvent`). This is the last chance before making the authentication fail.

We provide some basic user provider, but it is recommended that you implement your own. Use them for inspiration.

#### A) The simple in memory user provider

[](#a-the-simple-in-memory-user-provider)

Implementation in `SimpleSSO\CommonBundle\Security\UserProvider\InMemory`.

This simple user provider do not stores anything in a persistent way. It fetches the profile information from the SimpleSSO server API each time the user is authenticated.

To use this user provider, you need to register it as a service, and configure it in the security config:

```
# config/packages/simplesso_common.yaml

services:
    # ...

    SimpleSSO\CommonBundle\Security\UserProvider\InMemory\UserProvider: ~
```

```
# config/packages/security.yaml

security:
    providers:
        simple_in_memory:
            id: SimpleSSO\CommonBundle\Security\UserProvider\InMemory\UserProvider

    firewalls:
        main:
            provider: simple_in_memory # Use it in your main firewall.
            # ...
```

By default, it will instantiate a `SimpleSSO\CommonBundle\Security\UserProvider\InMemory\SimpleInMemoryUser` object to stores the user's profile. The object is then serialized in session in the security token. You can configure another class that you implemented if needed. This class must implement `SimpleSSO\CommonBundle\Security\UserProvider\SimpleSSOUserInterface`.

```
# config/packages/simplesso_common.yaml

services:
    # ...

    SimpleSSO\CommonBundle\Security\UserProvider\InMemory\UserProvider:
        arguments:
            $userClass: App\Model\Data\MyCustomSimpleSSOUser
```

#### B) A Doctrine based user provider

[](#b-a-doctrine-based-user-provider)

TODO.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~53 days

Total

8

Last Release

2757d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2178680?v=4)[Vinorcola](/maintainers/Vinorcola)[@Vinorcola](https://github.com/Vinorcola)

---

Top Contributors

[![Vinorcola](https://avatars.githubusercontent.com/u/2178680?v=4)](https://github.com/Vinorcola "Vinorcola (12 commits)")

### Embed Badge

![Health badge](/badges/simplesso-common-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/simplesso-common-bundle/health.svg)](https://phpackages.com/packages/simplesso-common-bundle)
```

###  Alternatives

[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[symfony/ux-cropperjs

Cropper.js integration for Symfony

19280.3k3](/packages/symfony-ux-cropperjs)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[pentiminax/ux-datatables

DataTables.net integration for Symfony

605.6k](/packages/pentiminax-ux-datatables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
