Skip to content

Commit

Permalink
sercurity config 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
yooonwodyd committed Feb 20, 2024
1 parent 6e1e189 commit 7313a86
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions src/main/java/com/gdsc/pikpet/config/security/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,20 @@ public SecurityFilterChain securityFilterChain(
.requestMatchers("/login/**").permitAll()
.anyRequest().authenticated()
);

http.csrf(cr -> cr.disable());
http.
cors(cors -> cors.configurationSource(corsConfigurationSource()))
.formLogin(
formLogin ->
formLogin.loginPage("/loginPage/formLogin")
.loginProcessingUrl("/login")
.usernameParameter("username")
.passwordParameter("password")
.defaultSuccessUrl("/loginPage/loginSuccess",true)// user 같이 정보 반환, 프런트 연결시 변경 필요
.failureHandler((request, response, exception) -> {
System.out.println("exception = " + exception.getMessage());
response.sendRedirect("/loginPage/loginFail");
})
);
http.csrf(csrf -> csrf.disable())
.cors(cors -> cors.configurationSource(corsConfigurationSource()))
.formLogin(
formLogin ->
formLogin.loginPage("/loginPage/formLogin")
.loginProcessingUrl("/login")
.usernameParameter("username")
.passwordParameter("password")
.defaultSuccessUrl("/loginPage/loginSuccess", true)// user 같이 정보 반환, 프런트 연결시 변경 필요
.failureHandler((request, response, exception) -> {
System.out.println("exception = " + exception.getMessage());
response.sendRedirect("/loginPage/loginFail");
})
);
return http.build();
}

Expand Down

0 comments on commit 7313a86

Please sign in to comment.