Example #1
0
 public static function laravel_init()
 {
     // Load AutoLoad Aliases
     \Laravel\Autoloader::alias('\\Cloudmanic\\WarChest\\Libraries\\LaravelAuth', 'LaravelAuth');
     \Laravel\Autoloader::alias('\\Cloudmanic\\WarChest\\Libraries\\Me', 'Me');
     // Extend the Laravel Auth library to use our own custom driver.
     \Auth::extend('cloudmanic_auth', function () {
         return new LaravelAuth();
     });
     // Set Api auth filter.
     \Laravel\Routing\Route::filter('api_auth', function () {
         return CloudAuth::sessioninit();
     });
     // Build a micro for activating a class or not. We use this in a main navigation
     // to set the html class to active or not.
     \Laravel\HTML::macro('is_active', function ($name, $home = false, $class = 'active') {
         $base = \Laravel\URI::segment(1);
         // Is the the default route?
         if ($home && empty($base)) {
             return $class;
         }
         // Compare the segment.
         if ($base == $name) {
             return $class;
         }
         return '';
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('glokon/crowd-auth');
     \Auth::extend('crowd-auth', function () {
         return new \Illuminate\Auth\Guard(new \GLOKON\CrowdAuth\CrowdAuthUserProvider(), \App::make('session.store'));
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('t3chnik/verify-l4-mongolid');
     \Auth::extend('verify', function () {
         return new Guard(new VerifyUserProvider(new BcryptHasher(), \Config::get('auth.model')), \App::make('session'));
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('djbarnes/l4-ldap-auth');
     \Auth::extend('l4-ldap-auth', function () {
         return new Guard(new L4LdapAuthUserProvider(\Config::get('l4-ldap-auth::ldapserver'), \Config::get('l4-ldap-auth::ldapadmindn'), \Config::get('l4-ldap-auth::ldapadminpw'), \Config::get('l4-ldap-auth::searchbase'), \Config::get('l4-ldap-auth::searchfield')), \App::make('session'));
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('gxela/leback-auth');
     \Auth::extend('leback-auth', function () {
         $routes = \Config::get('leback-auth::model_routes');
         $url = implode('/', \Request::segments());
         $model = \Config::get('auth.model');
         $name = last(explode('\\', $model));
         $prefix = null;
         $route = null;
         //$provider = '\Gxela\LebackAuth\Providers\LebackAuthGenericProvider';
         $guard = '\\Gxela\\LebackAuth\\Guards\\LebackAuthGenericGuard';
         foreach ($routes as $route => $_model) {
             $route = explode('/', $route);
             $prefix = array_shift($route);
             if (starts_with($url, $prefix)) {
                 $model = $_model;
                 $name = last(explode('\\', $model));
                 $guard = '\\Gxela\\LebackAuth\\Guards\\LebackAuth' . $name . 'Guard';
                 //$provider = '\Gxela\LebackAuth\Providers\LebackAuth'.$name.'Provider';
                 break;
             }
         }
         return new $guard(new \Gxela\LebackAuth\Providers\LebackAuthGenericProvider(new BcryptHasher(), $model), \App::make('session.store'));
     });
 }
 public function boot()
 {
     \Auth::extend('taketwo', function ($app) {
         $provider = new TaketwoUserProvider($app['hash']);
         return new Guard($provider, $app['session.store']);
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('ehtasham89/laravel-apiauth-driver');
     \Auth::extend('lvapiauth', function () {
         return new Guard(new Providers\LvApiAuthUserProvider(), \App::make('session.store'));
     });
 }
Example #8
0
 public function boot()
 {
     \Auth::extend('tracker_driver', function () {
         $model = \Config::get('auth.model');
         $provider = new EloquentUserProvider(\App::make('hash'), $model);
         return new TrackerGuard($provider, \App::make('session.store'));
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('lucor/laravel-auth-file-driver');
     \Auth::extend('file', function ($app) {
         $users = \Config::get('laravel-auth-file-driver::users');
         return new Guard(new FileUserProvider($users, $app['hash'], $app['cache']), $app['session.store']);
     });
 }
Example #10
0
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('canaan5/power');
     \Auth::extend('power', function () {
         return new Guard(new PowerUserProvider(new BcryptHasher(), \Config::get('auth.model', 'User')), \App::make('session.store'));
     });
     // $this->exceptionMessages();
 }
 /**
  * Boot the service provider.
  */
 public function boot()
 {
     \Auth::extend('sysguard', function ($app) {
         return new EloquentUserProvider($app['hash'], $app['config']['auth.model']);
     });
     $this->publishes([__DIR__ . '/migrations/' => $this->app->databasePath() . '/migrations'], 'migrations');
     $this->loadViewsFrom(__DIR__ . '/views', 'sysguard');
 }
 /**
  * Bootstrap the application events.
  */
 public function boot()
 {
     //Registers the new Auth Provider
     \Auth::extend('multilogin', function ($app) {
         return new MultisourceDriver(SourceFactory::generateConfiguration());
     });
     //Enables the config copy from the Base Config File
     $this->publishes([__DIR__ . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'multisource.php' => config_path('multisource.php')]);
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/../../config/permiso.php' => config_path('permiso.php')]);
     \Auth::extend('permiso', function () {
         $model = \Config::get('auth.model');
         $provider = new \Illuminate\Auth\EloquentUserProvider(\App::make('hash'), $model);
         return new PermisoGuard($provider, \App::make('session.store'));
     });
     $this->commands('command.permiso.migration');
 }
 public function boot()
 {
     $this->publishes([__DIR__ . '/../../config/verify.php' => config_path('verify.php')], 'config');
     $this->mergeConfigFrom(__DIR__ . '/../../config/verify.php', 'verify');
     $this->publishes([__DIR__ . '/../../database/migrations/' => base_path('database/migrations')], 'migrations');
     $this->publishes([__DIR__ . '/../../database/seeds/' => base_path('database/seeds')], 'seeds');
     \Auth::extend('verify', function ($app) {
         return new VerifyGuard(new VerifyUserProvider($app['hash'], $app['config']['auth.model']), $app['session.store']);
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/config/auth.php' => config_path('auth.php'), __DIR__ . '/config/auth.routes.php' => config_path('auth.routes.php')]);
     $this->loadTranslationsFrom(__DIR__ . '/lang', 'identify');
     $this->loadViewsFrom(__DIR__ . '/views', 'identify');
     \Auth::extend('session', function ($app, $name, array $config) {
         $model = $app['config']['auth.providers.users.model'];
         $provider = new IdentifyUserProvider($app['hash'], $model);
         return new Identify($name, $provider, $this->app['session.store'], $this->app['request']);
     });
 }
 public function boot()
 {
     $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'Kaamaru\\Forums');
     \Validator::resolver(function ($translator, $data, $rules, $messages) {
         return new ValidationRules($translator, $data, $rules, $messages);
     });
     \Auth::extend('eloquent', function ($app) {
         $model = $this->app['config']['auth.model'];
         return new EloquentUserProvider($this->app['hash'], $model);
     });
     require __DIR__ . '/Http/breadcrumbs.php';
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('jeroen-g/laravel-auth');
     // Extending the default Auth of Laravel.
     \Auth::extend('eloquent', function ($app) {
         // Retrieving the user model.
         $model = $app['config']['auth.model'];
         // Creating an Eloquent provider for the Guard class, which requires the app's hashing class and model from above.
         $provider = new Providers\EloquentUserProvider($app['hash'], $model);
         // This creates the new, extended Guard class, really the core of this package. It requires the app's session storage class.
         return new Guard($provider, \App::make('session.store'));
     });
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     \Auth::extend('auth0', function ($app) {
         // Let the container build the repository for us
         $userRepository = \App::make('\\Auth0\\Login\\Contract\\Auth0UserRepository');
         $provider = new Auth0UserProvider($userRepository);
         return new \Illuminate\Auth\Guard($provider, $app['session.store']);
     });
     $this->publishes([__DIR__ . '/../../config/config.php' => config_path('laravel-auth0.php')]);
     $laravel = app();
     $oldInfoHeaders = ApiClient::getInfoHeadersData();
     if ($oldInfoHeaders) {
         $infoHeaders = InformationHeaders::Extend($oldInfoHeaders);
         $infoHeaders->setEnvironment('Laravel', $laravel::VERSION);
         $infoHeaders->setPackage('laravel-auth0', self::SDK_VERSION);
         ApiClient::setInfoHeadersData($infoHeaders);
     }
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $d2em = $this->app['d2embridge'];
     $d2cache = $this->app['d2cachebridge'];
     $d2em->getConfiguration()->setMetadataCacheImpl($d2cache);
     $d2em->getConfiguration()->setQueryCacheImpl($d2cache);
     $d2em->getConnection()->getConfiguration()->setResultCacheImpl($d2cache);
     if (isset($this->d2config['sqllogger']['enabled']) && $this->d2config['sqllogger']['enabled']) {
         $logger = new Logger\Laravel();
         if (isset($this->d2config['sqllogger']['level'])) {
             $logger->setLevel($this->d2config['sqllogger']['level']);
         }
         $d2em->getConnection()->getConfiguration()->setSQLLogger($logger);
     }
     if (isset($this->d2config['auth']['enabled']) && $this->d2config['auth']['enabled']) {
         \Auth::extend('doctrine2bridge', function () {
             return new \Illuminate\Auth\Guard(new Auth\Doctrine2UserProvider(\D2EM::getRepository($this->d2config['auth']['entity']), new \Illuminate\Hashing\BcryptHasher()), \App::make('session.store'));
         });
     }
 }
Example #20
0
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require app_path() . '/filters.php';
/*
 * Setup Propel
 */
if (defined('LARAVEL_ENV')) {
    require app_path() . '/config/propel/config.php';
    if (LARAVEL_ENV == 'local') {
        $con = Propel\Runtime\Propel::getWriteConnection(\Zidisha\User\Map\UserTableMap::DATABASE_NAME);
        Debugbar::addCollector(new DebugBar\DataCollector\PDO\PDOCollector($con->getConnection()));
    }
}
/*
 * Extending auth class with propel
 */
Auth::extend('propel', function ($app) {
    return new \Zidisha\Auth\PropelUserProvider();
});
/**
 * Custom validator class
 */
Validator::resolver(function ($translator, $data, $rules, $messages) {
    return new Zidisha\Form\ZidishaValidator($translator, $data, $rules, $messages);
});
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     \Auth::extend('config', function ($app) {
         return new ConfigUserProvider();
     });
 }
Example #22
0
/*
|--------------------------------------------------------------------------
| Set The Default Timezone
|--------------------------------------------------------------------------
|
| We need to set the default timezone for the application. This controls
| the timezone that will be used by any of the date methods and classes
| utilized by Laravel or your application. The timezone may be set in
| your application configuration file.
|
*/
date_default_timezone_set(Config::get('application.timezone'));
/*
|--------------------------------------------------------------------------
| Start / Load The User Session
|--------------------------------------------------------------------------
|
| Sessions allow the web, which is stateless, to simulate state. In other
| words, sessions allow you to store information about the current user
| and state of your application. Here we'll just fire up the session
| if a session driver has been configured.
|
*/
if (!Request::cli() and Config::get('session.driver') !== '') {
    Session::load();
}
Auth::extend('avare', function () {
    return new Avare();
});
/*Custom Functions*/
require_once 'helpers.php';
<?php

//ACTIVATE CMSAUTH
Auth::extend('cmsauth', function () {
    return new Cms_Auth();
});
//FORCE SESSION TO BE LOADED - AVOID TASKS ERROR
if (Request::cli() and Config::get('session.driver') !== '') {
    Session::load();
}
//SET LOCALE
setlocale(LC_ALL, Config::get('cms::settings.locale'), Config::get('cms::settings.locale') . '.utf8');
//CMS COMPOSER
View::composer('cms::interface.layouts.default', function ($view) {
    Asset::container('header')->add('app_js', Config::get('application.url') . '/site/js');
    Asset::container('header')->add('jquery', 'bundles/cms/js/jquery.min.js', 'app_js');
    Asset::container('footer')->add('cms', 'bundles/cms/js/cms.js', 'jquery');
    Asset::container('footer')->add('bootstrap', 'bundles/cms/js/bootstrap.min.js', 'cms');
    Asset::container('header')->add('bootstrapcss', 'bundles/cms/css/bootstrap.css');
    Asset::container('header')->add('main', 'bundles/cms/css/cms.css', 'bootstrapcss');
    //NOTY
    Asset::container('header')->add('notyjs', 'bundles/cms/js/jquery.noty.js', 'jquery');
    Asset::container('header')->add('notycss', 'bundles/cms/css/jquery.noty.css', 'bootstrapcss');
    Asset::container('header')->add('notytwitcss', 'bundles/cms/css/noty_theme_twitter.css', 'notycss');
    //HEADER_DATA IS SET IN RESTFUL CONTROLLERS
    if (!isset($view->header_data)) {
        $view->header_data = array('title' => Config::get('cms::settings.name'));
    }
    $topbar = (Auth::check() and ROLE >= Config::get('cms::settings.roles.editor')) ? 'cms::interface.partials.navigation.logged' : 'cms::interface.partials.navigation.login';
    $view->menu = View::make('cms::interface.partials.menu')->nest('topbar', $topbar, array('sections' => Config::get('cms::settings.sections'), 'interface' => Config::get('cms::settings.interface')));
    //TOP_DATA IS SET IN RESTFUL CONTROLLERS
Example #24
0
// RBAC
$app->register(Nord\Lumen\Rbac\Doctrine\DoctrineStorageServiceProvider::class);
$app->register(Nord\Lumen\Rbac\RbacServiceProvider::class);
// Serializer
$app->register(Nord\Lumen\Serializer\SerializerServiceProvider::class);
// Date
$app->register(Jenssegers\Date\DateServiceProvider::class);
/*
|--------------------------------------------------------------------------
| Extend Managers
|--------------------------------------------------------------------------
|
| todo: Write this
|
*/
// @see http://laravel.com/docs/5.0/extending#authentication
Auth::extend('nettineuvoja', function ($app) {
    return $app[Nettineuvoja\Access\App\UserService::class];
});
/*
|--------------------------------------------------------------------------
| Load The Application Routes
|--------------------------------------------------------------------------
|
| Next we will include the routes file so that they can all be added to
| the application. This will provide all of the URLs the application
| can respond to, as well as the controllers that may handle them.
|
*/
require __DIR__ . '/../app/Common/routes.php';
return $app;
Example #25
0
| should not be changing these here. If you need to change these you
| may do so within the paths.php file and they will be bound here.
|
*/
$app->bindInstallPaths(require __DIR__ . '/paths.php');
/*
|--------------------------------------------------------------------------
| Load The Application
|--------------------------------------------------------------------------
|
| Here we will load the Illuminate application. We'll keep this is in a
| separate location so we can isolate the creation of an application
| from the actual running of the application with a given request.
|
*/
$framework = $app['path.base'] . '/vendor/laravel/framework/src';
require $framework . '/Illuminate/Foundation/start.php';
Auth::extend('apiuser', function () {
    return new ApiUserProvider();
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
 protected function extendsAuth()
 {
     $authenticator = config('doctrine.auth.authenticator', null);
     if (!is_null($authenticator) && class_exists($authenticator)) {
         \Auth::extend('doctrine.auth', function (Application $app) use($authenticator) {
             return $app->make($authenticator, [config('doctrine.auth.model')]);
         });
     }
 }
 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     \Auth::extend('custom.auth', function () {
         return new AccountServiceProvider(new User());
     });
 }
Example #28
0
App::error(function (ModelNotFoundException $e) {
    return Response::make('Not Found', 404);
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
Auth::extend('custom_eloquent', function () {
    $provider = new CustomEloquentUserProvider('User');
    return $provider;
});
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require app_path() . '/filters.php';
<?php

// Assuming we have set the following in app/config/auth.php:
//
// 'driver' => 'doctrine2bridge'
// this assumes no namespace:
Auth::extend('doctrine2bridge', function () {
    return new \Illuminate\Auth\Guard(new \Doctrine2Bridge\Auth\Doctrine2UserProvider(D2EM::getRepository('\\Entities\\User'), new \Illuminate\Hashing\BcryptHasher()), App::make('session.store'));
});
Example #30
0
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for the application.
|
*/
App::down(function () {
    return Response::make("Be right back!", 503);
});
/**
 * Ban 用户认证自定义处理方法
 */
Auth::extend('banUserAuth', function () {
    return new \Illuminate\Auth\Guard(new O2OMobileUserProvider(new \Illuminate\Hashing\BcryptHasher(), Config::get('auth.model')), \App::make('session.store'));
});
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
if (App::environment() != 'develop') {
    // 开发环境下还是要报出错误来比较好
    require app_path() . '/errors.php';
}