diff --git a/API-Gateway/pom.xml b/API-Gateway/pom.xml
index 6623607..bba660f 100644
--- a/API-Gateway/pom.xml
+++ b/API-Gateway/pom.xml
@@ -5,7 +5,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.7.14
+ 3.3.13
org.training
@@ -15,7 +15,7 @@
API Gateway
17
- 2021.0.8
+ 2023.0.6
diff --git a/API-Gateway/src/main/java/org/training/api/gateway/ApiGatewayApplication.java b/API-Gateway/src/main/java/org/training/api/gateway/ApiGatewayApplication.java
index 5d16c71..5c7a3ef 100644
--- a/API-Gateway/src/main/java/org/training/api/gateway/ApiGatewayApplication.java
+++ b/API-Gateway/src/main/java/org/training/api/gateway/ApiGatewayApplication.java
@@ -2,10 +2,8 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
-@EnableEurekaClient
public class ApiGatewayApplication {
public static void main(String[] args) {
diff --git a/API-Gateway/src/main/java/org/training/api/gateway/config/SecurityConfig.java b/API-Gateway/src/main/java/org/training/api/gateway/config/SecurityConfig.java
index a028a68..5316127 100644
--- a/API-Gateway/src/main/java/org/training/api/gateway/config/SecurityConfig.java
+++ b/API-Gateway/src/main/java/org/training/api/gateway/config/SecurityConfig.java
@@ -2,6 +2,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;
@@ -13,17 +14,13 @@ public class SecurityConfig {
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
http
- .authorizeExchange()
- //ALLOWING REGISTER API FOR DIRECT ACCESS
- .pathMatchers("/api/users/register").permitAll()
- //ALL OTHER APIS ARE AUTHENTICATED
- .anyExchange().authenticated()
- .and()
- .csrf().disable()
- .oauth2Login()
- .and()
- .oauth2ResourceServer()
- .jwt();
+ .authorizeExchange(exchanges -> exchanges
+ .pathMatchers("/api/users/register").permitAll()
+ .anyExchange().authenticated()
+ )
+ .csrf(csrf -> csrf.disable())
+ .oauth2Login(Customizer.withDefaults())
+ .oauth2ResourceServer(oauth2 -> oauth2.jwt(Customizer.withDefaults()));
return http.build();
}
-}
\ No newline at end of file
+}
diff --git a/Account-Service/pom.xml b/Account-Service/pom.xml
index 3d4401c..c9a215e 100644
--- a/Account-Service/pom.xml
+++ b/Account-Service/pom.xml
@@ -5,7 +5,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.7.15
+ 3.3.13
org.training
@@ -15,7 +15,7 @@
Account Service
17
- 2021.0.8
+ 2023.0.6
@@ -64,6 +64,11 @@
spring-boot-starter-test
test
+
+ commons-io
+ commons-io
+ 2.11.0
+
diff --git a/Account-Service/src/main/java/org/training/account/service/exception/GlobalExceptionHandler.java b/Account-Service/src/main/java/org/training/account/service/exception/GlobalExceptionHandler.java
index ac70343..9e53140 100644
--- a/Account-Service/src/main/java/org/training/account/service/exception/GlobalExceptionHandler.java
+++ b/Account-Service/src/main/java/org/training/account/service/exception/GlobalExceptionHandler.java
@@ -3,6 +3,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
+import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
@@ -27,13 +28,13 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
*
* @param ex The MethodArgumentNotValidException that occurred.
* @param headers The HttpHeaders of the response.
- * @param status The HttpStatus of the response.
+ * @param status The HttpStatusCode of the response.
* @param request The WebRequest of the response.
* @return A ResponseEntity with an ErrorResponse and HttpStatus.BAD_REQUEST.
*/
@Override
public ResponseEntity