PHPackages                             quidage/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. quidage/oneloginsaml-bundle

ActiveSymfony-bundle

quidage/oneloginsaml-bundle
===========================

OneLogin SAML Bundle for Symfony2

v1.4.1(7y ago)07MITPHP

Since Jun 17Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (7)Versions (9)Used By (0)

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

[](#oneloginsamlbundle)

OneLogin SAML Bundle for Symfony2. ()

[![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)[![Latest Stable Version](https://camo.githubusercontent.com/6ae5f2536da3fb92b963fc525a4e01bc69b68a5f7dd00fff77b4f5171efc9009/68747470733a2f2f706f7365722e707567782e6f72672f68736c61766963682f6f6e656c6f67696e73616d6c2d62756e646c652f762f737461626c65)](https://packagist.org/packages/hslavich/oneloginsaml-bundle) [![Latest Unstable Version](https://camo.githubusercontent.com/aa17ee86eacb07b7e0be1f445fc85d31a314639bf52401daea87a8b5d0fbf21a/68747470733a2f2f706f7365722e707567782e6f72672f68736c61766963682f6f6e656c6f67696e73616d6c2d62756e646c652f762f756e737461626c65)](https://packagist.org/packages/hslavich/oneloginsaml-bundle) [![Total Downloads](https://camo.githubusercontent.com/8538b7414ec6f0762a8c0c8b672c09ff12903949ca89a8802daabd5dd6cf90fb/68747470733a2f2f706f7365722e707567782e6f72672f68736c61766963682f6f6e656c6f67696e73616d6c2d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/hslavich/oneloginsaml-bundle)

[![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": "dev-master"
}
```

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:    ^/
            anonymous: true
            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: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/saml/metadata, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { 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`

```
