mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +08:00
chore: 移除 lombok 依赖
再度精简依赖
This commit is contained in:
@@ -17,9 +17,10 @@
|
||||
package top.charles7c.continew.starter.auth.justauth.autoconfigure;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
import org.redisson.client.RedisClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
@@ -33,11 +34,12 @@ import top.charles7c.continew.starter.core.constant.PropertiesConstants;
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@AutoConfiguration(before = com.xkcoding.justauth.autoconfigure.JustAuthAutoConfiguration.class)
|
||||
@ConditionalOnProperty(prefix = "justauth", name = PropertiesConstants.ENABLED, havingValue = "true", matchIfMissing = true)
|
||||
public class JustAuthAutoConfiguration {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(JustAuthAutoConfiguration.class);
|
||||
|
||||
/**
|
||||
* 自定义 State 缓存实现
|
||||
*/
|
||||
|
@@ -23,8 +23,8 @@ import cn.dev33.satoken.stp.StpLogic;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
@@ -42,17 +42,20 @@ import top.charles7c.continew.starter.core.util.GeneralPropertySourceFactory;
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@AutoConfiguration
|
||||
@RequiredArgsConstructor
|
||||
@ComponentScan("top.charles7c.continew.starter.auth.satoken.exception")
|
||||
@EnableConfigurationProperties(SaTokenExtensionProperties.class)
|
||||
@ConditionalOnProperty(prefix = "sa-token.extension", name = PropertiesConstants.ENABLED, havingValue = "true")
|
||||
@PropertySource(value = "classpath:default-auth-satoken.yml", factory = GeneralPropertySourceFactory.class)
|
||||
public class SaTokenAutoConfiguration implements WebMvcConfigurer {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SaTokenAutoConfiguration.class);
|
||||
private final SaTokenExtensionProperties properties;
|
||||
|
||||
public SaTokenAutoConfiguration(SaTokenExtensionProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
// 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验
|
||||
|
@@ -18,8 +18,9 @@ package top.charles7c.continew.starter.auth.satoken.autoconfigure;
|
||||
|
||||
import cn.dev33.satoken.dao.SaTokenDao;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.client.RedisClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
@@ -34,9 +35,10 @@ import top.charles7c.continew.starter.cache.redisson.autoconfigure.RedissonAutoC
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
abstract class SaTokenDaoConfiguration {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SaTokenDaoConfiguration.class);
|
||||
|
||||
private SaTokenDaoConfiguration() {
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
package top.charles7c.continew.starter.auth.satoken.autoconfigure;
|
||||
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import top.charles7c.continew.starter.auth.satoken.properties.SaTokenDaoProperties;
|
||||
@@ -29,7 +28,6 @@ import top.charles7c.continew.starter.auth.satoken.properties.SaTokenSecurityPro
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "sa-token.extension")
|
||||
public class SaTokenExtensionProperties {
|
||||
|
||||
@@ -54,4 +52,41 @@ public class SaTokenExtensionProperties {
|
||||
*/
|
||||
@NestedConfigurationProperty
|
||||
private SaTokenSecurityProperties security;
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public Class<? extends StpInterface> getPermissionImpl() {
|
||||
return permissionImpl;
|
||||
}
|
||||
|
||||
public void setPermissionImpl(Class<? extends StpInterface> permissionImpl) {
|
||||
this.permissionImpl = permissionImpl;
|
||||
}
|
||||
|
||||
public SaTokenDaoProperties getDao() {
|
||||
return dao;
|
||||
}
|
||||
|
||||
public void setDao(SaTokenDaoProperties dao) {
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
public SaTokenSecurityProperties getSecurity() {
|
||||
return security;
|
||||
}
|
||||
|
||||
public void setSecurity(SaTokenSecurityProperties security) {
|
||||
this.security = security;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SaTokenExtensionProperties{" + "enabled=" + enabled + ", permissionImpl=" + permissionImpl + ", dao=" + dao + ", security=" + security + '}';
|
||||
}
|
||||
}
|
||||
|
@@ -20,7 +20,8 @@ import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.exception.NotPermissionException;
|
||||
import cn.dev33.satoken.exception.NotRoleException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
@@ -32,10 +33,11 @@ import top.charles7c.continew.starter.web.model.R;
|
||||
* @author Charles7c
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class GlobalSaTokenExceptionHandler {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(GlobalSaTokenExceptionHandler.class);
|
||||
|
||||
/**
|
||||
* 认证异常-登录认证
|
||||
*/
|
||||
|
@@ -17,7 +17,6 @@
|
||||
package top.charles7c.continew.starter.auth.satoken.properties;
|
||||
|
||||
import cn.dev33.satoken.dao.SaTokenDao;
|
||||
import lombok.Data;
|
||||
import top.charles7c.continew.starter.auth.satoken.enums.SaTokenDaoType;
|
||||
|
||||
/**
|
||||
@@ -26,7 +25,6 @@ import top.charles7c.continew.starter.auth.satoken.enums.SaTokenDaoType;
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class SaTokenDaoProperties {
|
||||
|
||||
/**
|
||||
@@ -38,4 +36,25 @@ public class SaTokenDaoProperties {
|
||||
* 自定义持久层实现类(当 type 为 CUSTOM 时必填)
|
||||
*/
|
||||
private Class<? extends SaTokenDao> impl;
|
||||
|
||||
public SaTokenDaoType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(SaTokenDaoType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Class<? extends SaTokenDao> getImpl() {
|
||||
return impl;
|
||||
}
|
||||
|
||||
public void setImpl(Class<? extends SaTokenDao> impl) {
|
||||
this.impl = impl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SaTokenDaoProperties{" + "type=" + type + ", impl=" + impl + '}';
|
||||
}
|
||||
}
|
||||
|
@@ -16,19 +16,24 @@
|
||||
|
||||
package top.charles7c.continew.starter.auth.satoken.properties;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* SaToken 安全配置属性
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class SaTokenSecurityProperties {
|
||||
|
||||
/**
|
||||
* 排除(放行)路径配置
|
||||
*/
|
||||
private String[] excludes = new String[0];
|
||||
|
||||
public String[] getExcludes() {
|
||||
return excludes;
|
||||
}
|
||||
|
||||
public void setExcludes(String[] excludes) {
|
||||
this.excludes = excludes;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user