2017 © Pedro Peláez
 

library slim-basic-auth

HTTP Basic Auth Middleware for the Slim PHP Framework

image

opb/slim-basic-auth

HTTP Basic Auth Middleware for the Slim PHP Framework

  • Tuesday, February 24, 2015
  • by opb
  • Repository
  • 1 Watchers
  • 5 Stars
  • 503 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 1 % Grown

The README.md

Basic Auth Middleware for Slim

This HTTP Basic Auth Middleware plugin for Slim. Key features:, (*1)

  • Protects a path and all sub-paths. For example, setting it to protect /admin will also protect /admin/foo and /admin/bar/baz but not /foo., (*2)

  • Provides an interface AuthCheckerInterface for you to implement, in order to check a username/password combo against your own user database. An example is provided below of this in use., (*3)

Install

Install via composer:, (*4)

{
    "require": {
        "opb/slim-basic-auth": "dev-master"
    }
}

Usage

The HttpBasicAuth middleware class is instantiated with two parameters: a mandatory implementation of AuthCheckerInterface and an optional array of options. The two options currently supported are the path to match, and the realm if you wish to set that. The example below shows how you might implement this., (*5)

// MyAuthClass - implementing the required AuthCheckerInterface

class MyAuthClass implements \Slim\Middleware\AuthCheckerInterface
{
    // only function required by the interface
    public function checkCredentials($username, $password)  {
        // interact with your own auth system
        // do some stuff and return true if authorised, false if not    
    }
}

// the rest of your Slim app, adding in the middleware

$app = new \Slim\Slim();

$authChecker = new MyAuthCLass;

$app->add(new \Slim\Middleware\HttpBasicAuth($authChecker, array(
    'path' => '/api', // optional, defaults to '/'
    'realm' => 'Protected API' // optional, defaults to 'Protected Area'
)));

The Versions

24/02 2015

dev-master

9999999-dev https://github.com/opb/slim-basic-auth

HTTP Basic Auth Middleware for the Slim PHP Framework

  Sources   Download

MIT

The Requires

 

middleware auth slim http auth

04/02 2015

0.2.2

0.2.2.0 https://github.com/opb/slim-basic-auth

HTTP Basic Auth Middleware for the Slim PHP Framework

  Sources   Download

MIT

The Requires

 

middleware auth slim http auth

14/06 2014

0.2.1

0.2.1.0 https://github.com/opb/slim-basic-auth

HTTP Basic Auth Middleware for the Slim PHP Framework

  Sources   Download

MIT

The Requires

 

middleware auth slim http auth

13/06 2014

0.2.0

0.2.0.0 https://github.com/opb/slim-basic-auth

HTTP Basic Auth Middleware for the Slim PHP Framework

  Sources   Download

MIT

The Requires

 

middleware auth slim http auth

12/06 2014

0.1.0

0.1.0.0 https://github.com/opb/slim-basic-auth

HTTP Basic Auth Middleware for the Slim PHP Framework

  Sources   Download

MIT

The Requires

 

middleware auth slim http auth