2017 © Pedro Peláez
 

library auth0-api-authentication-bundle

Integrate with Auth0 to bring API authentication to Symfony

image

fabricekabongo/auth0-api-authentication-bundle

Integrate with Auth0 to bring API authentication to Symfony

  • Friday, March 24, 2017
  • by fabricekabongo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 205 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

Installation

Badges:

Codacy Badge, (*1)

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*2)

$ composer require fabricekabongo/auth0symfonyapiauthenticator

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*3)

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*4)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new FabriceKabongo\Auth0\APIAuthenticationBundle\APIAuthenticationBundle(),
        );

        // ...
    }

    // ...
}

Then, set the authenticator and provider to these values on app/config/security.yml:, (*5)

# app/config/security.yml
security:
    # ...

    firewalls:
        secured_area:
            pattern: ^/youbaseurl
            stateless: true
            simple_preauth:
                authenticator: fabricekabongo.auth0.services.apikeyuserauthenticator
            provider: api_key_user_provider
            anonymous:    true

    providers:
        api_key_user_provider:
            id: fabricekabongo.auth0.services.apikeyuserprovider

    access_control:
        - { path: ^/youbaseurl, roles: ROLE_USER }
# app/config/config.yml
fabrice_kabongo_auth0_api_authentication_bundle:
    valid_audiences:
        - 'https://your.service.indentifier'
    authorized_iss:
        - 'https://youraccount.auth0.com'

See Auth0 APIs, (*6)

Step 3: write functional Test for your API

Create a functional test and extend the FabriceKabongo\Auth0\APIAuthenticationBundle\Test\AuthenticatedWebTestCase In your test cases create a client and pass it to the setUpClient methods with the role you want the user to have, (*7)

public function testMyOwnTestCase() 
{
    $client = $this->setUpClient(
        static::createClient(),
        ['ROLE_READ_PROFIL', 'ROLE_EDIT_PAYMENTINFO']
    );

    // do your http calls and do your test as usual
}

Step 4: Help me make this better and simpler. Please :)

Todo: Write unit test (how will I mock the JWS verifier) Todo: Create a new branch for other versions of Symfony (if works differently) Todo: Introduce awesome new features., (*8)

I love this project and will continue to work on it. Please do the same., (*9)

The Versions

24/03 2017

dev-master

9999999-dev

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

24/03 2017

v0.4.2

0.4.2.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

24/03 2017

v0.4.1

0.4.1.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

24/03 2017

v0.4.0

0.4.0.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

04/03 2017

v0.3.3

0.3.3.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

04/03 2017

v0.3.1

0.3.1.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

25/02 2017

v0.2.1

0.2.1.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

25/02 2017

v0.2.0

0.2.0.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

25/02 2017

v0.1.6

0.1.6.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

25/02 2017

v0.1.5

0.1.5.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

25/02 2017

v0.1.4

0.1.4.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

25/02 2017

v0.1.3

0.1.3.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo

25/02 2017

v0.1.1

0.1.1.0

Integrate with Auth0 to bring API authentication to Symfony

  Sources   Download

MIT

The Requires

 

by Fabrice Kabongo