From 98237cb7f77a923e9b54263667dc552b3d5c8f3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B7=B4=E5=8D=AB?= <14240332@qq.com>
Date: Fri, 30 Dec 2022 09:55:32 +0800
Subject: [PATCH] =?UTF-8?q?SecurityConfig=E6=96=87=E4=BB=B6=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=EF=BC=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
SC-boot/linkage-common/pom.xml | 36 ++++++++---------
.../main/java/jnpf/config/SecurityConfig.java | 40 ++-----------------
2 files changed, 21 insertions(+), 55 deletions(-)
diff --git a/SC-boot/linkage-common/pom.xml b/SC-boot/linkage-common/pom.xml
index 4d14bc16..8246bed1 100644
--- a/SC-boot/linkage-common/pom.xml
+++ b/SC-boot/linkage-common/pom.xml
@@ -130,24 +130,24 @@
sqljdbc4
${sqlserver.version}
-->
-
- com.oracle.database.jdbc
- ojdbc8
-
-
- com.oracle.database.nls
- orai18n
-
-
-
- com.dm
- DmJdbcDriver18
-
-
-
- com.kingbase8
- kingbase8-jdbc
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
org.postgresql
diff --git a/SC-boot/linkage-oauth/src/main/java/jnpf/config/SecurityConfig.java b/SC-boot/linkage-oauth/src/main/java/jnpf/config/SecurityConfig.java
index 8d4b1215..294be1e1 100644
--- a/SC-boot/linkage-oauth/src/main/java/jnpf/config/SecurityConfig.java
+++ b/SC-boot/linkage-oauth/src/main/java/jnpf/config/SecurityConfig.java
@@ -10,9 +10,6 @@ import org.springframework.security.config.annotation.authentication.builders.Au
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
*
@@ -23,23 +20,13 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
*/
@Configuration
@EnableWebSecurity
-public class SecurityConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer {
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
- //private UserDetailsServiceImpl userDetailsService;
- private UserDetailsService userDetailsService;
+ private UserDetailsServiceImpl userDetailsService;
@Autowired
private MyPasswordEncoder passwordEncoder;
- private static final String[] URL_WHITELIST = {
- "/favicon.ico",
- "/webjars/**",
- "/img.icons/**",
- "/swagger-resources/**",
- "/v3/api-docs/**",
- "/swagger-ui/**",
- "/doc.html",
- };
/**
* 配置请求路径
@@ -52,29 +39,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter implements WebM
http.headers().frameOptions().disable();
http.csrf().disable().authorizeRequests()
.antMatchers("/RSA/publicKey").permitAll()
- .antMatchers("/jmreport/**").anonymous()
- // 配置拦截规则
- .and()
- .authorizeRequests()
- .antMatchers(URL_WHITELIST).permitAll()
- .anyRequest().authenticated();
- }
- @Bean
- @Override
- public AuthenticationManager authenticationManagerBean() throws Exception {
- return super.authenticationManagerBean();
- }
-
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler("/**").addResourceLocations(
- "classpath:/static/");
- registry.addResourceHandler("swagger-ui.html")
- .addResourceLocations("classpath:/META-INF/resources/");
+ .antMatchers("/jmreport/**").anonymous();
- registry.addResourceHandler("/webjars/**")
- .addResourceLocations("classpath:/META-INF/resources/webjars/");
- registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
}
/**