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
protected void configure(HttpSecurity http) throws Exception {
http
.cors().and()
.oauth2Login().and()
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())

View File

@ -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");

View File

@ -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);
}

View File

@ -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")

View File

@ -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: