diff --git a/src/main/java/com/example/springbootapp/config/SecurityConfiguration.java b/src/main/java/com/example/springbootapp/config/SecurityConfiguration.java index 5e06b2d..d267e84 100644 --- a/src/main/java/com/example/springbootapp/config/SecurityConfiguration.java +++ b/src/main/java/com/example/springbootapp/config/SecurityConfiguration.java @@ -19,6 +19,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http + .cors().and() .oauth2Login().and() .csrf() .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) diff --git a/src/main/java/com/example/springbootapp/config/SimpleCORSFilter.java b/src/main/java/com/example/springbootapp/config/SimpleCORSFilter.java index a3f76ae..625555a 100644 --- a/src/main/java/com/example/springbootapp/config/SimpleCORSFilter.java +++ b/src/main/java/com/example/springbootapp/config/SimpleCORSFilter.java @@ -28,7 +28,7 @@ public class SimpleCORSFilter implements Filter { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; //request.getHeader("Origin") - response.setHeader("Access-Control-Allow-Origin", "http://localhost:3006"); + response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "600000"); diff --git a/src/main/java/com/example/springbootapp/controllers/SimulatorController.java b/src/main/java/com/example/springbootapp/controllers/SimulatorController.java index 82b8cf1..89c7273 100644 --- a/src/main/java/com/example/springbootapp/controllers/SimulatorController.java +++ b/src/main/java/com/example/springbootapp/controllers/SimulatorController.java @@ -6,7 +6,6 @@ import org.springframework.web.bind.annotation.*; import java.util.Map; -@CrossOrigin(origins = "http://localhost:3006") @RestController @RequestMapping("/simulator") public class SimulatorController { @@ -16,6 +15,7 @@ public class SimulatorController { @GetMapping("/start/{user_id}/{name}/{pwd}") public Map startSimulator(@PathVariable String user_id, @PathVariable String name, @PathVariable String pwd) throws InterruptedException { + return service.startSimulator(user_id, name, pwd); } diff --git a/src/main/java/com/example/springbootapp/controllers/UserController.java b/src/main/java/com/example/springbootapp/controllers/UserController.java index 171c8d7..27b4827 100644 --- a/src/main/java/com/example/springbootapp/controllers/UserController.java +++ b/src/main/java/com/example/springbootapp/controllers/UserController.java @@ -20,7 +20,7 @@ public class UserController { private ClientRegistration registration; public UserController(ClientRegistrationRepository registrations) { - this.registration = registrations.findByRegistrationId("okta"); + this.registration = registrations.findByRegistrationId("spirisim"); } @GetMapping("/api/user") diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 850a140..26906d6 100755 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -15,7 +15,6 @@ spring: issuer-uri: https://dev-125890.okta.com/oauth2/default datasource: driver-class-name: org.postgresql.Driver - password: riddhidave url: jdbc:postgresql:spirisim username: spirisim jpa: