2017 © Pedro Peláez
 

library authorization-middleware

PSR-7 Authorization Middleware

image

aist/authorization-middleware

PSR-7 Authorization Middleware

  • Wednesday, August 9, 2017
  • by aist
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Aist Authorization Middleware SensioLabsInsight

Build status ![Coverage Status][Master coverage image] ![Code Climate][Code Climate image] ![Sensio][SensioLabsInsight image] ![Packagist][Packagist image], (*1)

![License][License image], (*2)

PSR-7 Authorization Middleware., (*3)

Installation

Install via composer:, (*4)

$ composer require aist/authorization-middleware

Configuration

Add pipe to protect whole app, (*5)

// Add more middleware here that needs to introspect the routing results; this
// might include:
//
// - route-based authentication
// - route-based validation
// - etc.

// Authentication middleware
$app->pipe(\Aist\AuthenticationMiddleware\Middleware\AuthenticationMiddleware::class);

// Authorization middleware
// At this point, if no identity is set by authorization middleware, the
// UnauthorizedHandler kicks in; alternately, you can provide other fallback
// middleware to execute.
//$app->pipe(\Aist\AuthorizationMiddleware\Middleware\UnauthorizedHandler::class);
// Authorization
$app->pipe(\Aist\AuthorizationMiddleware\Middleware\AuthorizationMiddleware::class);

or use for specific route, (*6)

$app->get(
    '/',
    [
        \Aist\AuthenticationMiddleware\Middleware\AuthenticationMiddleware::class,
        \Aist\AuthorizationMiddleware\Middleware\AuthorizationMiddleware::class,
        App\Action\DashboardAction::class,
    ],
    'dashboard'
);

The Versions