diff --git a/springBootBlog/src/main/java/com/yen/mdblog/config/OAuthSecurityConfig.java b/springBootBlog/src/main/java/com/yen/mdblog/config/OAuthSecurityConfig.java index f54e0c3e5..5453a7f54 100644 --- a/springBootBlog/src/main/java/com/yen/mdblog/config/OAuthSecurityConfig.java +++ b/springBootBlog/src/main/java/com/yen/mdblog/config/OAuthSecurityConfig.java @@ -65,9 +65,18 @@ SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Except })); return httpSecurity + // login .formLogin() - .defaultSuccessUrl("/posts/all") + .defaultSuccessUrl("/posts/all", true) + .permitAll() .and() + // logout // TODO : fix logout redirect + .logout() + .logoutUrl("/logout") + .logoutSuccessUrl("classpath:/templates/logout.html") // Redirect to "/logout.html" after logout + .permitAll() + .and() + // auth .authorizeRequests(auth -> { auth.anyRequest().authenticated(); }) diff --git a/springBootBlog/src/main/resources/templates/logout.html b/springBootBlog/src/main/resources/templates/logout.html new file mode 100644 index 000000000..26fe6c1f7 --- /dev/null +++ b/springBootBlog/src/main/resources/templates/logout.html @@ -0,0 +1,11 @@ + + +
+ +