浏览代码

根 pom.xml 文件采用 dependencyManagement 引入 springboot, 不再使用 parent 引入, parent 引入时依赖版本存在问题, 具体是 actuator 依赖的 micrometer 版本和文档(https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.6-Release-Notes)中的不一致

reghao 9 月之前
父节点
当前提交
3c2ae3d07e
共有 2 个文件被更改,包括 21 次插入14 次删除
  1. 11 11
      data/data-service/src/main/java/cn/reghao/tnb/data/app/security/ResourceServerConfig.java
  2. 10 3
      pom.xml

+ 11 - 11
data/data-service/src/main/java/cn/reghao/tnb/data/app/security/ResourceServerConfig.java

@@ -17,7 +17,7 @@ import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder;
 import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter;
 import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter;
 import org.springframework.security.oauth2.server.resource.authentication.ReactiveJwtAuthenticationConverterAdapter;
-import org.springframework.security.oauth2.server.resource.web.server.authentication.ServerBearerTokenAuthenticationConverter;
+//import org.springframework.security.oauth2.server.resource.web.server.authentication.ServerBearerTokenAuthenticationConverter;
 import org.springframework.security.web.server.SecurityWebFilterChain;
 import reactor.core.publisher.Mono;
 
@@ -30,10 +30,10 @@ import java.security.spec.InvalidKeySpecException;
  * @author reghao
  * @date 2024-11-14 17:39:00
  */
-@Configuration
-@EnableWebFluxSecurity
+//@Configuration
+//@EnableWebFluxSecurity
 public class ResourceServerConfig {
-    private final CustomReactiveAuthorizationManager customReactiveAuthorizationManager;
+    /*private final CustomReactiveAuthorizationManager customReactiveAuthorizationManager;
     private final RedisTemplate<String, String> redisTemplate;
 
     public ResourceServerConfig(CustomReactiveAuthorizationManager customReactiveAuthorizationManager,
@@ -63,10 +63,10 @@ public class ResourceServerConfig {
                 // 所有的请求都交由此处进行权限判断处理
                 .anyExchange()
                 .access(customReactiveAuthorizationManager)
-                /*.and()
+                *//*.and()
                 .exceptionHandling()
                 .accessDeniedHandler(new CustomServerAccessDeniedHandler())
-                .authenticationEntryPoint(new CustomServerAuthenticationEntryPoint())*/
+                .authenticationEntryPoint(new CustomServerAuthenticationEntryPoint())*//*
                 .and()
                 .csrf()
                 .disable()
@@ -74,9 +74,9 @@ public class ResourceServerConfig {
         return http.build();
     }
 
-    /**
+    *//**
      * 从jwt令牌中获取认证对象
-     */
+     *//*
     public Converter<Jwt, ? extends Mono<? extends AbstractAuthenticationToken>> jwtAuthenticationConverter() {
 
         // 从jwt 中获取该令牌可以访问的权限
@@ -93,9 +93,9 @@ public class ResourceServerConfig {
         return new ReactiveJwtAuthenticationConverterAdapter(jwtAuthenticationConverter);
     }
 
-    /**
+    *//**
      * 解码jwt
-     */
+     *//*
     public ReactiveJwtDecoder jwtDecoder() {
         RSAPublicKey rsaPublicKey = getPublicKey();
         ReactiveJwtDecoder jwtDecoder =  NimbusReactiveJwtDecoder
@@ -115,5 +115,5 @@ public class ResourceServerConfig {
         }
 
         return null;
-    }
+    }*/
 }

+ 10 - 3
pom.xml

@@ -31,15 +31,22 @@
         <spring-cloud.version>2021.0.9</spring-cloud.version>
     </properties>
 
-    <parent>
+    <!--<parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
         <version>2.6.15</version>
-        <relativePath/> <!-- lookup parent from repository -->
-    </parent>
+        <relativePath/> &lt;!&ndash; lookup parent from repository &ndash;&gt;
+    </parent>-->
 
     <dependencyManagement>
         <dependencies>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${springboot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
             <dependency>
                 <groupId>org.springframework.cloud</groupId>
                 <artifactId>spring-cloud-dependencies</artifactId>