2017 © Pedro Peláez
 

library bono-auth

Bono Auth

image

xinix-technology/bono-auth

Bono Auth

  • Tuesday, March 7, 2017
  • by reekoheek
  • Repository
  • 1 Watchers
  • 1 Stars
  • 580 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 19 Versions
  • 5 % Grown

The README.md

bono-auth

Your solution to use authorization and authentication with Bono Framework., (*1)

Setup

To use bono-auth you have to setup bono using bono-auth middleware in config.php., (*2)

'bono.middlewares' => array(
  '\\Xinix\\BonoAuth\\Middleware\\AuthMiddleware' => array(
    ...
  ),
),

bono-auth has two drivers to use, each will have distinct configuration:, (*3)

Xinix\BonoAuth\Driver\NormAuth

'bono.middlewares' => array(
  '\\Xinix\\BonoAuth\\Middleware\\AuthMiddleware' => array(
    'driver' => '\\Xinix\\BonoAuth\\Driver\\NormAuth'
  ),
),

Xinix\BonoAuth\Driver\OAuth

'bono.middlewares' => array(
  '\\Xinix\\BonoAuth\\Middleware\\AuthMiddleware' => array(
    'driver' => '\\Xinix\\BonoAuth\\Driver\\OAuth',
    'debug' => true, // enable or disable debug
    'baseUrl' => 'http://to.your.oauth.provider',
    'authUrl' => '/oauth/auth', // URI to access auth
    'tokenUrl' => '/oauth/token', // URI to get token
    'revokeUrl' => '/oauth/revoke', // URI to revoke auth
    'clientId' => '*the client id*',
    'clientSecret' => '*the client secret*',
    'redirectUri' => \Bono\Helper\URL::site('/login'), // application redirect url
    'scope' => 'user',
  ),
),

Above configuration will enable default bono-auth. The default value will prevent guest to access to every pages accessed. And after user get login, he will be able to access every pages available., (*4)

Authorization

To authorize/deauthorize specific pages, you have to write codes to register filter "auth.authorize" that run before the middleware invoked by system. Usually you can put this codes in provider file. The codes will be in this following form:, (*5)

$app->filter('auth.authorize', function ($options) {
  // something to do
  return $allowed;
});

Return value

If the return value will be the one of the following conditions: - True (bool), url is authorized - False (bool), url is not authorized - (original argument), bono-auth will decide authorization for you, the default is logined user authorize to access and guest user is not authorized, (*6)

Arguments

The filter will accept single argument $options. As the nature of Bono Filter, the $options will be return value of previous ran of the same context name function. The first time value of $options will be the URI string (or assoc array contains URI string)., (*7)

If the $options is_bool, it means one of previous filter functions already handle the URI, you can skip the current filter function by adding if-statement., (*8)

$app->filter('auth.authorize', function ($options) {
  if (is_bool($options)) {
    return $options;
  }
  // something to do
});

The Versions

07/03 2017

v2.x-dev

2.9999999.9999999.9999999-dev

Bono Auth

  Sources   Download

MIT

The Requires

 

The Development Requires

20/05 2016

2.0.2

2.0.2.0

Bono Auth

  Sources   Download

MIT

The Requires

 

The Development Requires

15/05 2016

2.0.1

2.0.1.0

Bono Auth

  Sources   Download

MIT

The Requires

 

The Development Requires

15/05 2016

2.0.0

2.0.0.0

Bono Auth

  Sources   Download

MIT

The Requires

 

The Development Requires

09/09 2015

dev-master

9999999-dev

Bono Auth

  Sources   Download

MIT

The Requires

 

09/09 2015

1.0.2

1.0.2.0

Bono Auth

  Sources   Download

MIT

The Requires

 

07/08 2015

0.2.2

0.2.2.0

Bono Auth

  Sources   Download

MIT

The Requires

 

07/08 2015

1.0.0

1.0.0.0

Bono Auth

  Sources   Download

MIT

The Requires

 

07/08 2015

1.0.1

1.0.1.0

Bono Auth

  Sources   Download

MIT

The Requires

 

13/07 2015

0.2.1

0.2.1.0

Bono Auth

  Sources   Download

MIT

The Requires

 

03/11 2014

0.2.0

0.2.0.0

Bono Auth

  Sources   Download

MIT

The Requires

 

13/09 2014

0.1.6

0.1.6.0

Bono Auth

  Sources   Download

MIT

The Requires

 

13/09 2014

0.1.5

0.1.5.0

Bono Auth

  Sources   Download

MIT

The Requires

 

09/09 2014

0.1.4

0.1.4.0

Bono Auth

  Sources   Download

MIT

The Requires

 

08/09 2014

0.1.3

0.1.3.0

Bono Auth

  Sources   Download

MIT

The Requires

 

02/01 2014

0.1.1

0.1.1.0

Bono Auth

  Sources   Download

MIT

The Requires

 

02/01 2014

0.1.2

0.1.2.0

Bono Auth

  Sources   Download

MIT

The Requires

 

02/01 2014

0.0.1

0.0.1.0

Bono Auth

  Sources   Download

MIT

The Requires

 

02/01 2014

0.1.0

0.1.0.0

Bono Auth

  Sources   Download

MIT

The Requires