Code Monkey home page Code Monkey logo

webman-jwt's People

Contributors

jeis4n avatar kyour-cn avatar microwan0928 avatar tinywan avatar tx9991 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

webman-jwt's Issues

获取方式建议

1、建议增加GET的获取方式,有的项目并不是从header里放。
2、建议增加验证方法,入参是token和uid,判断两个是否相同

refreshtoken过期的问题

按照目前这种情况,假如token有效期两小时,refreshtoken有效期7天。token过期了,可以凭refreshtoken获取新token,但是refreshtoken一直是7天有效期的话,就会出现,当refreshtoken过期了的时候,就需要重新登录了,这种场景下,就可能会出现用户正在正常使用的过程中,突然需要重新登录了

建议增加一些新功能

  1. 可以根据 access_token 或 用户id ,让这一 access_token 失效
  2. 限制登录用户同时在线的客户端数量

🥰

单点登录设置client,无效

if ($config['is_single_device']) {
            $client = $extend['extend']['client'] ?? self::TOKEN_CLIENT_WEB;
            RedisHandler::generateToken($config['cache_token_pre'],  (string) $client,  (string) $extend['id'], $config['access_exp'], $token['access_token']);
}

这里获取$extend['extend']['client'] 多写了一个['extend']

Tinywan\Jwt\JwtToken::getUser() 方法返回值

/**
 * @desc: 获取当前用户信息
 * @return array
 * @author Tinywan(ShaoBo Wan)
 */
public static function getUser():array
{
    $config = self::_getConfig();
    if (is_callable($config['user_model'])) {
        return $config['user_model'](self::getCurrentId()) ?? [];
    }
    return [];
}

Tinywan\Jwt\JwtToken::getUser() 方法返回值如果定死了array就不能在 配置文件里返回模型对象了

token key使用ip

Redis::setex($cacheKey . ':' . request()->getRealIp(), $args['cache_token_ttl'], $args['access_token']);
自己项目改一下很简单,但是感觉作为插件不是很合适
比如"JWT:TOKEN:1000:127.0.0.1"
当用户切换wifi和移动网络的时候,原token就失效了,然后就需要刷新token或者重新生成token。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.