Giter VIP home page Giter VIP logo

vains-sofia / authorization-example Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 6.0 5.73 MB

Spring OAuth2 Authorization Server集成与拓展项目,包括认证服务搭建、三方登录对接、自定义grant_type方式获取token、前后端分离实现,客户端、资源服务、前端单体项目对接认证服务实现等

License: Apache License 2.0

Java 79.05% Dockerfile 0.16% PLpgSQL 1.55% CSS 2.19% HTML 4.41% JavaScript 0.10% Vue 9.11% TypeScript 3.43%

authorization-example's People

Contributors

vains-sofia avatar

Stargazers

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

Watchers

 avatar

authorization-example's Issues

RedisOperator getHashAll的bug

下面代码不对

    public <T> T getHashAll(String key, Class<T> clazz) {
        Map<String, Object> entries = hashOperations().entries(key);
        if (ObjectUtils.isEmpty(entries)) {
            return null;
        }
        return JsonUtils.objectCovertToObject(entries, clazz);
    }

1.泛型根本没有用到
2.return JsonUtils.objectCovertToObject(entries, clazz);
-> return JsonUtils.objectCovertToObject(entries,Map.class,String.class, clazz)
setHashAll就已经这么用了

   public void setHashAll(String key, Object value) {
        Map<String, Object> map = JsonUtils.objectCovertToObject(value, Map.class, String.class, Object.class);
        hashOperations().putAll(key, map);
    }

return JsonUtils.objectCovertToObject(entries, clazz);

redis 存储的认证信息 timeout 默认值是-1,导致数据堆积。

下面的代码如果用户设置的timeout都是不到1分钟。那么 between 就变成0。实质上变成无期限了。
而且代码角度无期限的东西都是不太好的,如果最后的最大值还是0或者-1,
那么将timeout设置成30min(id token的默认值)或者60min(refresh token的默认值)。

            // 计算时间差
            Duration between = Duration.between(Instant.now(), maxInstant.get());
            // 转为分钟
            maxTimeout = between.toMinutes();

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.