2017 © Pedro Peláez
 

library auth-handler

PSR7 Aura\Auth Authentication Handler

image

vperyod/auth-handler

PSR7 Aura\Auth Authentication Handler

  • Friday, July 29, 2016
  • by jnj
  • Repository
  • 1 Watchers
  • 2 Stars
  • 129 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 2 % Grown

The README.md

vperyod.auth-handler

Aura\Auth Authentication middleware, (*1)

![Latest version][ico-version] Build Status ![Coverage Status][ico-scrutinizer] Quality Score, (*2)

Installation

composer require vperyod/auth-handler

Usage

See Aura\Auth documentation., (*3)

// Create handler with Auth and ResumeService instance
$handler = new Vperyod\AuthHandler\AuthHandler($auth, $resume);

// Optionally set the `AuthAttribute`, the name of the attribute on which to
// store the `AuthAttribute` in the `Request`. Defaults to 'aura/auth:auth'
$handler->setAuthAttribute('auth');

// Add to your middleware stack, radar, relay, etc.
$stack->middleware($handler);

// Subsequest dealings with `Request` will have the `Auth` instance available at
// the previous specified atribute
$auth = $request->getAttribute('auth');


// The `AuthRequestAwareTrait` should make dealings easier.
//
// Have all your objects that deal with the auth attribute on the request use
// the `AuthRequestAwareTrait` and have your DI container use the setter, so that 
// they all know where the auth object is stored.

class MyMiddleware
{
    use \Vperyod\AuthHandler\AuthRequestAwareTrait;

    public function __invoke($request, $response, $next)
    {
        $auth = $this->getAuth($request);
        $status = $this->getAuthStatus($request);
        $isValid = $this->isAuthValid($request);

        // ...
        return $next($request, $response);
    }
}

class MyInputExtractor
{

    use \Vperyod\AuthHandler\AuthRequestAwareTrait;

    public funciton __invoke($request)
    {
        return [
            'auth' => $this->getAuth($request),
            'data' => $request->getParsedBody()
        ];
    }
}

The Versions

29/07 2016

dev-develop

dev-develop https://github.com/vperyod/vperyod.auth-handler

PSR7 Aura\Auth Authentication Handler

  Sources   Download

MIT

The Requires

 

The Development Requires

by jake johns

17/04 2016

dev-master

9999999-dev https://github.com/vperyod/vperyod.auth-handler

PSR7 Aura\Auth Authentication Handler

  Sources   Download

MIT

The Requires

 

The Development Requires

by jake johns

17/04 2016

0.2.0

0.2.0.0 https://github.com/vperyod/vperyod.auth-handler

PSR7 Aura\Auth Authentication Handler

  Sources   Download

MIT

The Requires

 

The Development Requires

by jake johns

14/02 2016

0.1.0

0.1.0.0 https://github.com/jnjxp/jnjxp.auth-handler

PSR7 Aura\Auth Authentication Handler

  Sources   Download

MIT

The Requires

 

The Development Requires

by jake johns