承接 ellipse/session-validation 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ellipse/session-validation

Composer 安装命令:

composer require ellipse/session-validation

包简介

Psr-15 middleware allowing to validate the user session ownership

README 文档

README

This package provides a Psr-15 middleware allowing to validate the user session ownership.

Require php >= 7.0

Installation composer require ellipse/session-validation

Run tests ./vendor/bin/kahlan

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.

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.

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

<?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);

统计信息

  • 总下载量: 70
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固