PHP code example of xinix-technology / bono-auth

1. Go to this page and download the library: Download xinix-technology/bono-auth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xinix-technology / bono-auth example snippets


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

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

'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',
  ),
),

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

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