refactor(auth/satoken): JWT 配置支持启用/关闭

This commit is contained in:
2024-02-05 23:39:44 +08:00
parent 2afb0b625f
commit c33a6709f5
2 changed files with 14 additions and 0 deletions

View File

@@ -87,6 +87,7 @@ public class SaTokenAutoConfiguration implements WebMvcConfigurer {
*/ */
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "sa-token.extension", name = "enableJwt", havingValue = "true")
public StpLogic stpLogic() { public StpLogic stpLogic() {
return new StpLogicJwtForSimple(); return new StpLogicJwtForSimple();
} }

View File

@@ -34,6 +34,11 @@ public class SaTokenExtensionProperties {
*/ */
private boolean enabled = false; private boolean enabled = false;
/**
* 启用 JWT
*/
private boolean enableJwt = false;
/** /**
* 持久层配置 * 持久层配置
*/ */
@@ -54,6 +59,14 @@ public class SaTokenExtensionProperties {
this.enabled = enabled; this.enabled = enabled;
} }
public boolean isEnableJwt() {
return enableJwt;
}
public void setEnableJwt(boolean enableJwt) {
this.enableJwt = enableJwt;
}
public SaTokenDaoProperties getDao() { public SaTokenDaoProperties getDao() {
return dao; return dao;
} }