All Downloads are FREE. Search and download functionalities are using the official Maven repository.

top.dcenter.ums.security.jwt.validator.UmsReAuthServiceImpl Maven / Gradle / Ivy

Go to download

ums-jwt feature: JWT 创建(通过接口自定义 Claims, 通过配置设置算法等), 校验(通过接口自定义校验规则), 刷新(自动刷新, 直接拒绝, 通过 refreshToken 刷新), 刷新的 JWT 使旧 JWT 失效引发的并发访问问题及黑名单.

There is a newer version: 2.2.42
Show newest version
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