Download the PHP package yzh52521/webman-jwt-auth without Composer

On this page you can find all versions of the php package yzh52521/webman-jwt-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package webman-jwt-auth

webman-jwt-auth

说明

目前支持如下三大类型加密方式:RSA,HASH,DSA。再各分256、384、512位。 默认是HS256,即hash 256位加密。

需要修改加密方式,请修改参数:signer,参数选项:

重要:RSA和DSA 都是非对称加密方式,除了修改参数signer外,需要配置:PUBLIC_KEY、PRIVATE_KEY两个参数, 这两个参数是密钥文件路径

安装

完整配置

说明:

支持多应用单点登录、多应用多点登录、多应用支持注销 token(token会失效)、支持多应用刷新 token

多应用单点登录:在该应用配置下只会有一个 token 生效,一旦刷新 token ,前面生成的 token 都会失效,一般以用户 id 来做区分

多应用多点登录:在该配置应用下token 不做限制,一旦刷新 token ,则当前配置应用的 token 会失效

注意:使用多应用单点登录或者多应用多点登录时,必须要开启黑名单,使用 redis 缓存。如果不开启黑名单,无法使 token 失效,生成的 token 会在有效时间内都可以使用(未更换证书或者 secret )。

多应用单点登录原理:JWT 有七个默认字段供选择。单点登录主要用到 jti 默认字段,jti 字段的值默认为缓存到redis中的key( 该key的生成为应用名称+存储的用户id),这个key的值会存一个签发时间,token检测会根据这个时间来跟token原有的签发时间对比,如果token原有时间小于等于redis存的时间,则认为无效

多应用多点登录原理:多点登录跟单点登录差不多,唯一不同的是jti的值不是应用名称+用户id,而是一个唯一字符串,每次调用 refreshToken 来刷新 token 或者调用 logout 注销 token 会默认把请求头中的 token 加入到黑名单,而不会影响到别的 token

token 不做限制原理:token 不做限制,在 token 有效的时间内都能使用,你只要把配置文件中的 blacklist_enabled 设置为 false 即可,即为关闭黑名单功能

token

Token 生成

Token 验证

Token 刷新

注意:必须验证通过才可以刷新Token 获取新Token

Token 注销

注销后Token就失效了(用户退出)

Token 获取过期时间

Token 移除黑名单token(指定某个)

Token 移除所有黑名单Token

Token 自动获取

支持以下方式自动获取

赋值方式

类型 途径 标识
Header Authorization Bearer Token
Cookie Cookie token
Url Request token

过期自动续签

auto_refresh => true

系统检测到 Token 已过期, 会自动续期并返回以下 header 信息。

前端需要接收最新 Token,下次异步请求时,携带此 Token。

备注 :多应用 默认是在应用目录里使用 跨应用 生成token 验证token 解析token 等使用如下


All versions of webman-jwt-auth with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0.0
workerman/webman-framework Version ^1.5.0
lcobucci/jwt Version ^4.2 || ^5.0
nesbot/carbon Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yzh52521/webman-jwt-auth contains the following files

Loading the files please wait ....