当前位置:   article > 正文

springboot 最新稳定版_spring boot 最新版本

spring boot 最新版本

1、springboot 核心依赖最新版本:

Spring Boot 2.3.3

Spring Cloud Hoxton.SR8

Spring Cloud Alibaba 2.2.2

MybatisPlus 3.4.0

Element 2.3.12

2、更新auth认证时,更改,RedisTokenStore记录登录用户,同时保证单点、多点登录,token认证成功之后对于相同的用户信息返回的token值是一样的,不适合在多地同时登录。

重写DefaultAuthenticationKeyGenerator

public class AuthenticationKeyGenerator extends DefaultAuthenticationKeyGenerator {private static final String CLIENT_ID = “client_id”;

private static final String SCOPE = “scope”;

private static final String USERNAME = “username”;

@Override

public String extractKey(OAuth2Authentication authentication) {Map values = new LinkedHashMap();

OAuth2Request authorizationRequest = authentication.getOAuth2Request();

if (!authentication.isClientOnly()) {//在用户名后面添加时间戳,使每次的key都不一样

values.put(USERNAME, authentication.getName()+System.currentTimeMillis());

}values.put(CLIENT_ID, authorizationRequest.getClientId());

if (authorizationRequest.getScope() != null) {values.put(SCOPE, OAuth2Utils.formatParameterList(new TreeSet(authorizationRequest.getScope())));

}return generateKey(values);

}

}

public TokenStore tokenStore() {RedisTokenStore redisTokenStore = new RedisTokenStore(redisConnectionFactory);

redisTokenStore.setAuthenticationKeyGenerator(new MyAuthenticationKeyGenerator());

return redisTokenStore;

}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/68779
推荐阅读
相关标签
  

闽ICP备14008679号