2017 © Pedro Peláez
 

library stack-basic-authentication

HTTP Basic Authentication Stack middleware

image

rossriley/stack-basic-authentication

HTTP Basic Authentication Stack middleware

  • Monday, March 24, 2014
  • by rossriley
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

HTTP Basic Authentication Stack Middleware

A [Stack]0 middleware to enable HTTP Basic Authentication following the STACK-2 Authentication conventions., (*1)

Fork Information

Package forked from the original work here: https://packagist.org/packages/dflydev/stack-basic-authentication, (*2)

This is an attempt to make it framework agnostic, since the original depends on Silex / Pimple, (*3)

Installation

Through Composer as rossriley/stack-basic-authentication., (*4)

Usage

The BasicAuthentication middleware accepts the following options:, (*5)

  • authenticator: (required) A callback used to ensure that the specified credentials are correct.
  • realm: The HTTP Basic Authentication realm as defined by RFC1945.
  • firewall: A firewall configuration compatible with dflydev/stack-firewall.
<?php

$authenticator = function ($username, $password) {
    // Given a username and password credentials, ensure that
    // the credentials are correct and return a token that
    // represents the user for this request.
    if ('admin' === $username && 'default' === $password) {
        return 'admin-user-token';
    }
};

$app = new Dflydev\Stack\BasicAuthentication($app, [
    'firewall' => [
        ['path' => '/', 'anonymous' => true],
        ['path' => '/login'],
    ],
    'authenticator' => $authenticator,
    'realm' => 'here there be dragons',
]);

Examples

See the examples/ directory for some live examples of this middleware in action., (*6)

License

MIT, see LICENSE., (*7)

Community

If you have questions or want to help out, join us in the #stackphp or #dflydev channels on irc.freenode.net., (*8)

The Versions

24/03 2014

dev-master

9999999-dev

HTTP Basic Authentication Stack middleware

  Sources   Download

MIT

The Requires

 

authentication stack stack-2