承接 klimesf/nette-jwt-user-storage 相关项目开发

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

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

klimesf/nette-jwt-user-storage

Composer 安装命令:

composer require klimesf/nette-jwt-user-storage

包简介

Nette IUserStorage implementation using JWT instead of sessions.

README 文档

README

Latest Stable Version License Build Status

DISCONTINUED

This repository is abandoned. You can use slepic's fork https://github.com/slepic/nette-jwt-user-storage.

Nette IUserStorage implementation using JWT access token instead of PHP sessions.

Disclaimer: If you don't know what JWT is, please refer to JWT draft or to JWT homepage.

On user login, the application stores jwt_access_token cookie instead of bad old PHPSESSID one. The cookie contains an encoded JWT signed by the application. The user authentication is then based on verifying the JWT rather than the session.

Warning: CSRF protection rules still apply!

This means you no longer need to solve PHP session implementation, scaling and testing problems. All the things that you would normally store in the SessionStorage can be stored in a key-value storage, where the JWT is a key.

This also means your application is ready to become SPA in the future. :)

Configuration

Register the extension in your config.neon.

extensions:
	jwtUserStorage: Klimesf\Security\DI\JWTUserStorageExtension

Then configure its required properties.

JWTUserStorage:
	privateKey: 'secret-cat'    # this secret is used to sign the JWT
	algorithm: 'HS256'          # this is the signing algorithm

Both the JWT and the cookie in which it's stored is by default set to expire in 20 days. If you want to fiddle with expiration time, use expiration option:

JWTUserStorage:
	expiration: 20 days     # sets JWT and cookie expiration time to 20 days (this is the default option)
	expiration: 20 minutes  # sets JWT and cookie expiration time to 20 minutes
	expiration: false       # sets JWT and cookie to never expire

By default, jti and iat (see JWT draft) are added to your JWTs. If you don't want to use them, set generateJti and generateIat options to false.

JWTUserStorage:
	generateJti: false          # disables jti generation for your JWT access tokens
	generateIat: false          # disables iat generation for your JWT access tokens

If you want to define your own Nette\Security\IIdentity serializer, which serializes your identity implementation into the JWT body, you can implement Klimesf\Security\IIdentitySerializer

namespace Your\Own;

class IdentitySerializer implements \Klimesf\Security\IIdentitySerializer
{
	// ...
}

and register it in configuration.

JWTUserStorage:
	identitySerializer: Your\Own\IdentitySerializer

And that's it, you're ready to go!

Known issues

  • If you are developing an app with JWT User Storage and you still see PHPSESSID in your cookies, it's probably because Tracy\Tracy uses it.

Discussion threads

Literature

klimesf/nette-jwt-user-storage 适用场景与选型建议

klimesf/nette-jwt-user-storage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 47 次下载、GitHub Stars 达 8, 最近一次更新时间为 2015 年 08 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 klimesf/nette-jwt-user-storage 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 klimesf/nette-jwt-user-storage 我们能提供哪些服务?
定制开发 / 二次开发

基于 klimesf/nette-jwt-user-storage 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-21