Created
February 24, 2016 16:52
-
-
Save mvdpoel/d76f5e90cb9dfd708c9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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