2017 © Pedro Peláez
 

library session-validation

Psr-15 middleware allowing to validate the user session ownership

image

ellipse/session-validation

Psr-15 middleware allowing to validate the user session ownership

  • Friday, February 23, 2018
  • by pmall
  • Repository
  • 1 Watchers
  • 0 Stars
  • 55 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Session validation

This package provides a Psr-15 middleware allowing to validate the user session ownership., (*1)

Require php >= 7.0, (*2)

Installation composer require ellipse/session-validation, (*3)

Run tests ./vendor/bin/kahlan, (*4)

Using the validate session middleware

This middleware let the developper define a callable producing a client signature from the processed Psr-7 request. This signature is stored in the session so the subsequent request client signatures can be compared to the saved one. When they do not match the session data are unset and the session id gets regenerated., (*5)

The callable passed to the middleware is called with the Psr-7 request being processed and must return an associative array containing client specific data. For example it's ip address or user agent., (*6)

The middleware can of course be used after the StartSessionMiddleware from ellipse/session-start in order to start a session., (*7)

<?php

namespace App;

use Psr\Http\Message\ServerRequestInterface;

use Ellipse\Session\ValidateSessionMiddleware;

// This callable must return an associative array.
$signature = function (ServerRequestInterface $request) {

    // Here we assume another middleware set the client ip attribute of the request.
    return [
        'client-ip' => $request->getAttribute('client-ip'),
    ];

};

// When using this middleware the session data are tied to the client ip address.
// Any attempt to access the session data with a different client ip address would
// invalidate the client session. Obvioulsy this middleware should only be processed
// after the session has started.
$middleware = new ValidateSessionMiddleware($signature);

The Versions

23/02 2018

dev-master

9999999-dev https://github.com/ellipsephp/session-validation

Psr-15 middleware allowing to validate the user session ownership

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar pmall

middleware validation session psr-15 ownership

23/02 2018

1.0.2

1.0.2.0 https://github.com/ellipsephp/session-validation

Psr-15 middleware allowing to validate the user session ownership

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar pmall

middleware validation session psr-15 ownership

23/01 2018

1.0.1

1.0.1.0 https://github.com/ellipsephp/session-validation

Psr-15 middleware allowing to validate the user session ownership

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar pmall

middleware validation session psr-15 ownership

18/11 2017

1.0.0

1.0.0.0 https://github.com/ellipsephp/session-validation

Psr-15 middleware allowing to validate the user session ownership

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar pmall

middleware validation session psr-15 ownership