2017 © Pedro Peláez
 

symfony-bundle sso-bundle

Single-sign-on bundle for Symfony2

image

t-ronx/sso-bundle

Single-sign-on bundle for Symfony2

  • Wednesday, June 18, 2014
  • by T-RonX
  • Repository
  • 1 Watchers
  • 0 Stars
  • 337 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Disclaimer

I am by no means a security expert. I'm not bad at it either, but I cannot vouch for the security of this bundle. You can use this in production if you want, but please do so at your own risk. That said, if you'd like to contribute to make this bundle better/safer, you can always create an issue or send a pull request., (*1)

Description

This bundle provides an easy way to integrate a single-sign-on in your website. It uses an existing ('main') firewall for the actual authentication, and redirects all configured SSO-routes to authenticate via a one-time-password., (*2)

Installation

Install using composer:, (*3)

php composer.phar require "fm/sso-bundle" 

Enable the bundle in the kernel:, (*4)

``` php // app/AppKernel.php $bundles[] = new FM\SingleSignOnBundle\FMSingleSignOnBundle();, (*5)


Configuration ------------- Enable sso-routes: ``` yaml # app/config/routing.yml: sso: resource: . type: sso otp: # this needs to be the same as the check_path, specified later on in security.yml pattern: /otp/

The bundle relies on an existing firewall to provide the actual authentication. To do this, you have to configure the single-sign-on login path to be behind that firewall, and make sure you need to be authenticated to access that route., (*6)

``` yaml, (*7)

app/config/config.yml:

fm_single_sign_on: host: mydomain.com login_path: /sso/, (*8)


``` yaml # app/config/security.yml security: access_control: - host: mydomain.com path: ^/sso/$ roles: [IS_AUTHENTICATED_FULLY]

``` yaml, (*9)

app/config/security.yml:

security: firewalls: main: pattern: ^/, (*10)


This makes sure the user has to authenticate first (using a login form). Now for each firewall (other than the main one), you can configure single-sign-on authentication using a one-time-password. The only thing you have to provide is a path and user provider. Everything else is handled by the bundle. ``` yaml # app/config/security.yml: security: firewalls: sso: pattern: ^/ fm_sso: provider: main check_path: /otp/ # path where otp will be authenticated

That's it, you're done!, (*11)

Domain restriction

Because we're working with multiple domains here, it's wise to configure the firewalls to only work for specific domains. Say we have domain A and B. Domain A is where the single-sign-on is done (main firewall), and domain B is authenticated by the one-time-password (sso firewall). We can use a request matcher service that confines the firewalls to specific domains. First we have to configure the request matchers:, (*12)

``` yaml, (*13)

app/config/security.yml

security: firewalls: main: request_matcher: my.security.request_matcher.main sso: request_matcher: my.security.request_matcher.sso, (*14)


Now we can implement them as services: ``` yaml # src/MyAwesomeBundle/Resources/config/services.yml services: my.security.request_matcher.main class: %security.matcher.class% arguments: ["/", "domain-a.com"] my.security.request_matcher.sso class: %security.matcher.class% arguments: ["/", "domain-b.com"]

The Versions

18/06 2014

dev-master

9999999-dev

Single-sign-on bundle for Symfony2

  Sources   Download

MIT

The Requires

 

login sso otp single-sign-on