Log in update with sso

This commit is contained in:
Riddhi Dave 2021-01-21 12:40:04 -05:00
parent 4a5f66f521
commit a1f97eab2d
5 changed files with 4 additions and 4 deletions

View File

@ -19,6 +19,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http http
.cors().and()
.oauth2Login().and() .oauth2Login().and()
.csrf() .csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()) .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())

View File

@ -28,7 +28,7 @@ public class SimpleCORSFilter implements Filter {
HttpServletRequest request = (HttpServletRequest) req; HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res; HttpServletResponse response = (HttpServletResponse) res;
//request.getHeader("Origin") //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-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "600000"); response.setHeader("Access-Control-Max-Age", "600000");

View File

@ -6,7 +6,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.Map; import java.util.Map;
@CrossOrigin(origins = "http://localhost:3006")
@RestController @RestController
@RequestMapping("/simulator") @RequestMapping("/simulator")
public class SimulatorController { public class SimulatorController {
@ -16,6 +15,7 @@ public class SimulatorController {
@GetMapping("/start/{user_id}/{name}/{pwd}") @GetMapping("/start/{user_id}/{name}/{pwd}")
public Map startSimulator(@PathVariable String user_id, @PathVariable String name, @PathVariable String pwd) throws InterruptedException { public Map startSimulator(@PathVariable String user_id, @PathVariable String name, @PathVariable String pwd) throws InterruptedException {
return service.startSimulator(user_id, name, pwd); return service.startSimulator(user_id, name, pwd);
} }

View File

@ -20,7 +20,7 @@ public class UserController {
private ClientRegistration registration; private ClientRegistration registration;
public UserController(ClientRegistrationRepository registrations) { public UserController(ClientRegistrationRepository registrations) {
this.registration = registrations.findByRegistrationId("okta"); this.registration = registrations.findByRegistrationId("spirisim");
} }
@GetMapping("/api/user") @GetMapping("/api/user")

View File

@ -15,7 +15,6 @@ spring:
issuer-uri: https://dev-125890.okta.com/oauth2/default issuer-uri: https://dev-125890.okta.com/oauth2/default
datasource: datasource:
driver-class-name: org.postgresql.Driver driver-class-name: org.postgresql.Driver
password: riddhidave
url: jdbc:postgresql:spirisim url: jdbc:postgresql:spirisim
username: spirisim username: spirisim
jpa: jpa: