top.dcenter.ums.security.jwt.validator.UmsReAuthServiceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ums-jwt Show documentation
Show all versions of ums-jwt Show documentation
ums-jwt feature: JWT 创建(通过接口自定义 Claims, 通过配置设置算法等), 校验(通过接口自定义校验规则),
刷新(自动刷新, 直接拒绝, 通过 refreshToken 刷新), 刷新的 JWT 使旧 JWT 失效引发的并发访问问题及黑名单.
package top.dcenter.ums.security.jwt.validator;
import org.springframework.security.oauth2.jwt.Jwt;
import top.dcenter.ums.security.jwt.JwtContext;
import top.dcenter.ums.security.jwt.api.validator.service.ReAuthService;
import top.dcenter.ums.security.jwt.properties.JwtProperties;
/**
* 检查是否需要重新登录认证的服务
* @author YongWu zheng
* @since 2021.1.4 16:29
*/
public class UmsReAuthServiceImpl implements ReAuthService {
private final String principalClaimName;
public UmsReAuthServiceImpl(JwtProperties jwtProperties) {
this.principalClaimName = jwtProperties.getPrincipalClaimName();
}
@Override
public Boolean isReAuth(Jwt jwt) {
String userId = jwt.getClaimAsString(principalClaimName);
return JwtContext.isReAuth(userId);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy