2017 © Pedro Peláez
 

ezplatform-bundle ezsocialloginbundle

Social login for eZ Platform

image

crevillo/ezsocialloginbundle

Social login for eZ Platform

  • Thursday, March 23, 2017
  • by crevillo
  • Repository
  • 2 Watchers
  • 1 Stars
  • 96 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 18 Versions
  • 0 % Grown

The README.md

Ez Social Login Bundle

Build StatusLatest Stable Version, (*1)

The eZ Social Login Bundle adds support for authenticating users via OAuth1.0a or OAuth2 in eZ Platform., (*2)

It just uses HwiOauthBundle, so you can refer to this documentation bundle to know how it internally works., (*3)

Installation

You can install this project via composer:, (*4)

composer require crevillo/ezsocialloginbundle

Documentation

You can use any of the social networks listed in HwiOauthBundle documentation. Please refer to that bundle in order to know how you can configure any of them., (*5)

Setting up this bundle

A) Add EzSocialLoginBundle to your project

composer require crevillo/ezsocialloginbundle:dev-master

B) Enable the bundle

Enable the bundle in the kernel, you will also need to enable HwiOauthBundle, (*6)

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
        new Crevillo\EzSocialLoginBundle\CrevilloEzSocialLoginBundle()
    );
}

C) Import the routing

Import the redirect.xml and login.xml routing files in your own routing file., (*7)

# app/config/routing.yml
hwi_oauth_redirect:
    resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
    prefix:   /connect

hwi_oauth_login:
    resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
    prefix:   /login

Note:, (*8)

The bundle will override default user login template provided by EzPublishCoreBundle. It might happen that you won't see any changes if any of your others bundles does that too. So, if you already have a customized login template, just add these lines anywhere in your content block of your template., (*9)

D) Configure Google resource owner

You will need to modify your config.yml file adding, (*10)

hwi_oauth:
    # list of names of the firewalls in which this bundle is active, this setting MUST be set
    firewall_names: [ezpublish_front]

Next, you can add your google app information and options under hwi_oauth > resource_owners settings, (*11)

hwi_oauth:
    # list of names of the firewalls in which this bundle is active, this setting MUST be set
    firewall_names: [ezpublish_front]
    resource_owners:
        your_google_app:
            type: google
            client_id: <your client id>
            client_secret: <your client secret>
            scope: "email profile"

E) Configuring the Security Layer

The bundle needs a service that is able to load users based on the user response of the oauth endpoint. It should implement the interface: HWI\Bundle\OAuthBundle\Security\Core\User\OAuthAwareUserProviderInterface. This bundle provides this service as an starting point, but you are free to create your own., (*12)

Our UserProvider will try to get the username from the social network. If there as already any user in the eZ Platform repository with this username, it will just return it., (*13)

If there is no user having that username, it will try to create a new one under your "Guest Accounts" user group and will also log in it., (*14)

F) Configure the oauth firewall

In the firewall configuration you will need to configure a login path for the resource owners you have configured previously. Additionally you will need to point the oauth firewall to the service this bundle provides:, (*15)

# app/config/security.yml
security:
    firewalls:
        # your other firewalls
        #
        ezpublish_front:
            anonymous: ~
            oauth:
                resource_owners:
                    google:             "/login/check-google"
                login_path:        /login
                use_forward:       false
                failure_path:      /login

                oauth_user_provider:
                    service:  crevillo.ezsocialloginbundle.oauth_aware.user_provider.service

Finally the paths you have defined in the previous step for your resource_owners must be adding to your routing., (*16)

# app/config/routing.yml
google_login:
    path: /login/check-google
  • Actually this is manually tested and seems to work for Facebook, Twitter, Google and Linkedin.

That's it!. Feel free to try any other social networks!., (*17)

The Versions

23/03 2017

dev-master

9999999-dev

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

21/07 2016
05/05 2016

0.9.1

0.9.1.0

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

31/03 2016

dev-check-emails-instead-of-usernames

dev-check-emails-instead-of-usernames

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

31/03 2016

0.9.0

0.9.0.0

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

30/03 2016

0.8.0

0.8.0.0

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

30/03 2016

dev-phpcs

dev-phpcs

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

29/03 2016

dev-twitter-support

dev-twitter-support

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

29/03 2016

0.7.2

0.7.2.0

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

29/03 2016

dev-override-linkedin-owner

dev-override-linkedin-owner

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

29/03 2016

0.7.1

0.7.1.0

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

28/03 2016

0.7.0

0.7.0.0

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

28/03 2016

dev-decouple-user-find-creation

dev-decouple-user-find-creation

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

23/03 2016

dev-more-testing

dev-more-testing

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

23/03 2016

0.5.0

0.5.0.0

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

20/03 2016

dev-test-user-is-not-present

dev-test-user-is-not-present

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

20/03 2016

0.1.0

0.1.0.0

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

20/03 2016

dev-unit-tests

dev-unit-tests

Social login for eZ Platform

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires