/auth0-bundle

Symfony integration for Auth0

Primary LanguagePHPMIT LicenseMIT

Auth0 integration with Symfony

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

Warning

This bundle is in very early development. However, it is being used in production for at least 3 applications.

Installation

Install with Composer:

composer require happyr/auth0-bundle auth0/auth0-php:@alpha php-http/message

Enable the bundle in AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new \Happyr\Auth0Bundle\HappyrAuth0Bundle(),
    ];

    return $bundles;
}

Add your credentials:

// app/config/config.yml
happyr_auth0:
  domain: example.eu.auth0.com
  client_id: my_client_id
  client_secret: my_secret
  cache: 'cache.provider.apc'

Configure your application for Singe Sign On (SSO).

// app/config/security.yml
security:
  firewalls:
    default:
      pattern:  ^/.*
      entry_point: 'happyr.auth0.security.authentication.entry_point.sso.default'
      auth0_sso:
        check_path: default_login_check
        login_path: user_login
        failure_path: startpage
      provider: default
      anonymous: ~
      logout:
        path:   default_logout
        target: _user_logout
        invalidate_session: true