diff --git a/pom.xml b/pom.xml
index e2c38d8..6c0c137 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,10 +50,25 @@
org.springframework.boot
spring-boot-starter-data-jpa
-
-
-
-
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ io.jsonwebtoken
+ jjwt-api
+ 0.11.5
+
+
+ io.jsonwebtoken
+ jjwt-impl
+ 0.11.5
+
+
+ io.jsonwebtoken
+ jjwt-jackson
+ 0.11.5
+
org.springframework.boot
spring-boot-starter-web
diff --git a/src/main/java/org/cmh/backend/Config/CorsConfig.java b/src/main/java/org/cmh/backend/Config/CorsConfig.java
deleted file mode 100644
index 7852636..0000000
--- a/src/main/java/org/cmh/backend/Config/CorsConfig.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.cmh.backend.Config;
-// CorsConfig.java
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.CorsRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-@Configuration
-public class CorsConfig {
-
- @Bean
- public WebMvcConfigurer corsConfigurer() {
- return new WebMvcConfigurer() {
- @Override
- public void addCorsMappings(CorsRegistry registry) {
- registry.addMapping("/**")
- .allowedOrigins("http://localhost:8080")
- .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
- .allowedHeaders("*")
- .allowCredentials(true);
- }
- };
- }
-}
-
diff --git a/src/main/java/org/cmh/backend/Config/SecurityConfig.java b/src/main/java/org/cmh/backend/Config/SecurityConfig.java
new file mode 100644
index 0000000..c917d0a
--- /dev/null
+++ b/src/main/java/org/cmh/backend/Config/SecurityConfig.java
@@ -0,0 +1,23 @@
+package org.cmh.backend.Config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
+import org.springframework.security.web.SecurityFilterChain;
+
+@Configuration
+public class SecurityConfig {
+
+ @Bean
+ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
+ // Use the new API to disable CSRF
+ http.csrf(AbstractHttpConfigurer::disable)
+ // Permit all requests
+ .authorizeHttpRequests(authorize -> authorize
+ .anyRequest().permitAll()
+ );
+
+ return http.build();
+ }
+}
diff --git a/src/main/java/org/cmh/backend/Utils/GlobalExceptionHandler.java b/src/main/java/org/cmh/backend/Utils/GlobalExceptionHandler.java
new file mode 100644
index 0000000..e9d8af5
--- /dev/null
+++ b/src/main/java/org/cmh/backend/Utils/GlobalExceptionHandler.java
@@ -0,0 +1,34 @@
+package org.cmh.backend.Utils;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+@ControllerAdvice
+public class GlobalExceptionHandler {
+
+ @ExceptionHandler(JwtValidationException.class)
+ public ResponseEntity