2017 © Pedro Peláez
 

library ht-oauth-server-client-module

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

image

hrevert/ht-oauth-server-client-module

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

  • Saturday, August 8, 2015
  • by hrevert
  • Repository
  • 3 Watchers
  • 4 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

HtOauth\Server\ClientModule

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc., (*1)

Master Branch Build Status Latest Stable Version Latest Unstable Version Total Downloads, (*2)

What's with the name?

The module provides a grant for a oauth2 server and it is also a client for oauth2 servers of facebook, google etc. So, it is named as server as well as client., (*3)

Installation

  • Add "hrevert/ht-oauth-server-client-module": "0.3.*" to composer.json and run php composer.phar update.
  • Enabled the following modules in config/application.config.php.
'modules' => array(
    'ZfrOAuth2Module\Server',
    'HtLeagueOauthClientModule',
    'HtOauthClientModule', 
    'HtOauth\Server\ClientModule',
),

Configuring the module

Setting the User class

User class must implement Hrevert\OauthClient\Model\UserInterface. Then, you need to modify the Doctrine mapping to associate this interface with your own user class., (*4)

return [
    'doctrine' => [
        'entity_resolver' => [
            'orm_default' => [
                'Hrevert\OauthClient\Model\UserInterface' => 'Application\Entity\User'
            ]
        ]
    ]
]

Provider configuration

You need to define the credentials like client id, client secret and other configuration. Read this for these configuration., (*5)

Adding grant types

return [
    'zfr_oauth2_server' => [
        'grants' => [
            // .. other grants,
            'HtOauth\Server\ClientModule\Grant\Oauth2Client',
        ]
    ]
]

Enabling providers

Enable providers by adding records to the table oauth_provider., (*6)

Autocreating user

When a new user tries to log in, s/he is not allowed to log in by default., (*7)

To automatically create a new user, you need to specify a callable for creating a user., (*8)


return [ 'ht_oauth_service_client' => [ 'create_user_callable' => function(\HtLeagueOauthClientModule\Model\UserInterface $userDetails) { $user = ......; $userProvider = new \Hrevert\OauthClient\Entity\UserProvider(); $userProvider->setUser($user); return $userProvider; // or just $user = ......; return $user; } ] ];

How It Works

Login with OAuth 2.0

  1. Client: Client sends a POST request to the server at /oauth/token with oauth2 authorization code or access token.
  2. Server: With authorization code, authorization code is exchanged for provider access token.
  3. Server: User information is retrived using the provider access token from Step 2.
  4. Server: Look up the user by the unique provider id. If user already exists, grab the existing user, otherwise create a new user account.
  5. Server: Reply with a new access token.

The Versions

08/08 2015

dev-master

9999999-dev

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hrevert Technologies

08/08 2015
27/11 2014

dev-oauth1-grant

dev-oauth1-grant

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hrevert Technologies

24/10 2014

0.2.0

0.2.0.0

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hrevert Technologies

31/08 2014

dev-small-refactor

dev-small-refactor

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hrevert Technologies

28/08 2014

0.1.2

0.1.2.0

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hrevert Technologies

28/08 2014

0.1.1

0.1.1.0

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hrevert Technologies

26/08 2014

0.1.0

0.1.0.0

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hrevert Technologies

22/08 2014

0.0.1

0.0.1.0

A Zend Framework 2 module which provides custom grant for zfr-oauth2-server to authenticate users via third party applications like facebook, google etc

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hrevert Technologies