PHPackages                             prolix/oneloginsaml-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. prolix/oneloginsaml-bundle

ActiveSymfony-bundle[Authentication &amp; Authorization](/categories/authentication)

prolix/oneloginsaml-bundle
==========================

OneLogin SAML Bundle for Symfony

v2.1.16(3y ago)0306MITPHP

Since Jun 17Pushed 3y agoCompare

[ Source](https://github.com/prolixtechnikos/OneloginSamlBundle)[ Packagist](https://packagist.org/packages/prolix/oneloginsaml-bundle)[ RSS](/packages/prolix-oneloginsaml-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (7)Versions (29)Used By (0)

OneloginSamlBundle
==================

[](#oneloginsamlbundle)

OneLogin SAML Bundle for Symfony. ()

[![Latest Stable Version](https://camo.githubusercontent.com/a3e157b119c32c3b26482b418f2a7b2e220f0e498a5057594c9cff8d02a8ba1a/68747470733a2f2f706f7365722e707567782e6f72672f68736c61766963682f6f6e656c6f67696e73616d6c2d62756e646c652f76)](//packagist.org/packages/hslavich/oneloginsaml-bundle) [![Latest Unstable Version](https://camo.githubusercontent.com/aa17ee86eacb07b7e0be1f445fc85d31a314639bf52401daea87a8b5d0fbf21a/68747470733a2f2f706f7365722e707567782e6f72672f68736c61766963682f6f6e656c6f67696e73616d6c2d62756e646c652f762f756e737461626c65)](//packagist.org/packages/hslavich/oneloginsaml-bundle) [![Total Downloads](https://camo.githubusercontent.com/8538b7414ec6f0762a8c0c8b672c09ff12903949ca89a8802daabd5dd6cf90fb/68747470733a2f2f706f7365722e707567782e6f72672f68736c61766963682f6f6e656c6f67696e73616d6c2d62756e646c652f646f776e6c6f616473)](//packagist.org/packages/hslavich/oneloginsaml-bundle) [![License](https://camo.githubusercontent.com/a5800297e61cc33ad7925d2b6f7f32791526f00269a1045815cf2ef7732a7614/68747470733a2f2f706f7365722e707567782e6f72672f68736c61766963682f6f6e656c6f67696e73616d6c2d62756e646c652f6c6963656e7365)](//packagist.org/packages/hslavich/oneloginsaml-bundle)

[![Build Status](https://camo.githubusercontent.com/94b5269f13493bcce2ee53b2ebf7fde5d4aec286355ff2bdb28b1864360bd2ef/68747470733a2f2f7472617669732d63692e6f72672f68736c61766963682f4f6e656c6f67696e53616d6c42756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hslavich/OneloginSamlBundle)[![Coverage Status](https://camo.githubusercontent.com/59a30bd4f92467f6d22ebaee9db139397ab2fec44e34a5d1d99539618cad26fb/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f68736c61766963682f4f6e656c6f67696e53616d6c42756e646c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/hslavich/OneloginSamlBundle?branch=master)

[![SensioLabsInsight](https://camo.githubusercontent.com/1c616aa4bfeacbec3732c910d5cdc87d9487a041040b4ee679da43d658cadb89/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64373461653336312d656638642d343337652d623864362d6138363237343931636366612f6269672e706e67)](https://insight.sensiolabs.com/projects/d74ae361-ef8d-437e-b8d6-a8627491ccfa)

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

[](#installation)

Install with composer

```
"require": {
    "hslavich/oneloginsaml-bundle": "^2.0"
}
```

> Using of `dev-master` version deprecated, use a specific version instead (i.e. 2.0).
> In the future `master` branch will be removed (approximately in the fall '21).

Run composer update

```
composer update hslavich/oneloginsaml-bundle
```

Enable the bundle in `app/AppKernel.php`

```
$bundles = array(
    // ...
    new Hslavich\OneloginSamlBundle\HslavichOneloginSamlBundle(),
)
```

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

[](#configuration)

Configure SAML metadata in `app/config/config.yml`. Check  for more info.

```
hslavich_onelogin_saml:
    # Basic settings
    idp:
        entityId: 'http://id.example.com/saml2/idp/metadata.php'
        singleSignOnService:
            url: 'http://id.example.com/saml2/idp/SSOService.php'
            binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
        singleLogoutService:
            url: 'http://id.example.com/saml2/idp/SingleLogoutService.php'
            binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
        x509cert: ''
    sp:
        entityId: 'http://myapp.com/app_dev.php/saml/metadata'
        assertionConsumerService:
            url: 'http://myapp.com/app_dev.php/saml/acs'
            binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
        singleLogoutService:
            url: 'http://myapp.com/app_dev.php/saml/logout'
            binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
        privateKey: ''
    # Optional settings
    baseurl: 'http://myapp.com'
    strict: true
    debug: true
    security:
        nameIdEncrypted:       false
        authnRequestsSigned:   false
        logoutRequestSigned:   false
        logoutResponseSigned:  false
        wantMessagesSigned:    false
        wantAssertionsSigned:  false
        wantNameIdEncrypted:   false
        requestedAuthnContext: true
        signMetadata: false
        wantXMLValidation: true
        signatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'
        digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256'
    contactPerson:
        technical:
            givenName: 'Tech User'
            emailAddress: 'techuser@example.com'
        support:
            givenName: 'Support User'
            emailAddress: 'supportuser@example.com'
    organization:
        en:
            name: 'Example'
            displayname: 'Example'
            url: 'http://example.com'
```

If you don't want to set contactPerson or organization, don't add those parameters instead of leaving them blank.

Configure firewall and user provider in `app/config/security.yml`

```
security:
    # ...

    providers:
        saml_provider:
            # Basic provider instantiates a user with default roles
            saml:
                user_class: 'AppBundle\Entity\User'
                default_roles: ['ROLE_USER']

    firewalls:
        app:
            pattern:    ^/
            saml:
                # Match SAML attribute 'uid' with username.
                # Uses getNameId() method by default.
                username_attribute: uid
                # Use the attribute's friendlyName instead of the name
                use_attribute_friendly_name: true
                check_path: saml_acs
                login_path: saml_login
            logout:
                path: saml_logout

    access_control:
        - { path: ^/saml/login, roles: PUBLIC_ACCESS }
        - { path: ^/saml/metadata, roles: PUBLIC_ACCESS }
        - { path: ^/, roles: ROLE_USER }
```

Edit your `app/config/routing`

```
hslavich_saml_sp:
    resource: "@HslavichOneloginSamlBundle/Resources/config/routing.yml"
```

Inject SAML attributes into User object (Optional)
--------------------------------------------------

[](#inject-saml-attributes-into-user-object-optional)

Your user class must implement `SamlUserInterface`

```
