Skip to content

Instantly share code, notes, and snippets.

@mvdpoel
Created February 24, 2016 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvdpoel/d76f5e90cb9dfd708c9f to your computer and use it in GitHub Desktop.
Save mvdpoel/d76f5e90cb9dfd708c9f to your computer and use it in GitHub Desktop.
<?php
/*
* This class handles authentication for the Laravel 4.2 framework
*/
class MOXMAN_LaravelAuthenticator_Plugin implements MOXMAN_Auth_IAuthenticator {
public function authenticate(MOXMAN_Auth_User $user) {
require __DIR__.'/../../../../../bootstrap/autoload.php';
$app = require_once __DIR__.'/../../../../../bootstrap/start.php';
$request = $app['request'];
$client = (new \Stack\Builder)
->push('Illuminate\Cookie\Guard', $app['encrypter'])
->push('Illuminate\Cookie\Queue', $app['cookie'])
->push('Illuminate\Session\Middleware', $app['session'], null);
$stack = $client->resolve($app);
$stack->handle($request);
$isAuthorized = Auth::check();
return $isAuthorized;
}
}
MOXMAN::getAuthManager()->add("LaravelAuthenticator", new MOXMAN_LaravelAuthenticator_Plugin());
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment