Skip to content

Commit

Permalink
logintest
Browse files Browse the repository at this point in the history
  • Loading branch information
HeeSung98 committed Nov 25, 2023
1 parent 3d758b8 commit 6f879ed
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public class SecurityConfig {
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{
http.authorizeHttpRequests(auth -> auth.requestMatchers("/**").permitAll());
http.formLogin(login -> login.loginPage("/hello").successHandler(loginSuccessHandler()));
http.oauth2Login(login -> login.loginPage("/hello").successHandler(loginSuccessHandler()));
http.csrf((csrf) -> csrf.disable());
http.oauth2Login(Customizer.withDefaults());
http.logout(Customizer.withDefaults());
http.rememberMe(rememberMe -> rememberMe.tokenValiditySeconds(60*60*24*60).userDetailsService(authUserDetailsService));

Expand Down
2 changes: 2 additions & 0 deletions user/src/main/java/com/weather/user/config/WebMvcConfig.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.weather.user.config;

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 WebMvcConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ public String hello() {
log.info("헬로우 컨트롤러 접근됨?");
return "hello";
}
@GetMapping("/loginTest")
public String helloTest(){
log.info("ddddd");
return "redirect:/oauth2/authorization/google";
}

@PostMapping("/user/signin")
public ResponseEntity<Optional<UserDTO>> signin(@RequestBody UserDTO userDTO) {
Expand Down
2 changes: 1 addition & 1 deletion user/src/main/resources/templates/hello.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<title>Title</title>
</head>
<body>
<a href="oauth2/authorization/google">hello</a>
<a href="loginTest">hello</a>
</body>
</html>

0 comments on commit 6f879ed

Please sign in to comment.