Skip to content

Instantly share code, notes, and snippets.

@cirpo

cirpo/auth_middleware.php

Last active Aug 29, 2015
Embed
What would you like to do?
<?php
$app = new Silex\Application();
$app = (new Stack\Builder())
->push('Dflydev\Stack\BasicAuthentication', [
'firewall' => [
['path' => '/', 'anonymous' => true],
['path' => '/login'],
],
'authenticator' => function ($username, $password) {
// authenticate
},
'realm' => 'here there be dragons',
])
->resolve($app);
$request = Request::createFromGlobals();
$response = $app->handle($request)->send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.