feat: 前段代码遵循ESLint规范
This commit is contained in:
parent
573641b426
commit
19fa6975eb
@ -1,17 +0,0 @@
|
|||||||
package io.dataease.auth.config;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@ConfigurationProperties(prefix = "dataease")
|
|
||||||
@Data
|
|
||||||
public class WhitelistConfig {
|
|
||||||
|
|
||||||
private List<String> whitelist;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,13 +1,9 @@
|
|||||||
package io.dataease.auth.service.impl;
|
package io.dataease.auth.service.impl;
|
||||||
|
|
||||||
import io.dataease.auth.config.WhitelistConfig;
|
|
||||||
import io.dataease.auth.service.ShiroService;
|
import io.dataease.auth.service.ShiroService;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
|
||||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -15,8 +11,7 @@ public class ShiroServiceImpl implements ShiroService {
|
|||||||
|
|
||||||
private final static String ANON = "anon";
|
private final static String ANON = "anon";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WhitelistConfig whitelistConfig;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> loadFilterChainDefinitionMap() {
|
public Map<String, String> loadFilterChainDefinitionMap() {
|
||||||
@ -47,11 +42,7 @@ public class ShiroServiceImpl implements ShiroService {
|
|||||||
filterChainDefinitionMap.put("/downline", ANON);
|
filterChainDefinitionMap.put("/downline", ANON);
|
||||||
filterChainDefinitionMap.put("/common-files/**", ANON);
|
filterChainDefinitionMap.put("/common-files/**", ANON);
|
||||||
|
|
||||||
List<String> whitelist = whitelistConfig.getWhitelist();
|
|
||||||
if (CollectionUtils.isNotEmpty(whitelist))
|
|
||||||
whitelist.forEach(path -> {
|
|
||||||
filterChainDefinitionMap.put(path, ANON);
|
|
||||||
});
|
|
||||||
|
|
||||||
filterChainDefinitionMap.put("/api/auth/logout", "logout");
|
filterChainDefinitionMap.put("/api/auth/logout", "logout");
|
||||||
filterChainDefinitionMap.put("/**", "jwt");
|
filterChainDefinitionMap.put("/**", "jwt");
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user