From c3038d3d54ae25a627c25254c7c0386105c1d53f Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Thu, 15 Jul 2021 14:21:35 +0200
Subject: [PATCH] add logout controller

---
 .../config/SmartHarvesterSecurityConfiguration.java          | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java b/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java
index e31f86a..cf1a8a2 100644
--- a/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java
+++ b/src/main/java/com/smartharvester/config/SmartHarvesterSecurityConfiguration.java
@@ -4,6 +4,8 @@ import com.smartharvester.security.jwt.AuthEntryPointJwt;
 import com.smartharvester.security.jwt.AuthTokenFilter;
 import com.smartharvester.security.services.UserServiceImpl;
 
+import javax.servlet.http.HttpServletResponse;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -56,7 +58,8 @@ public class SmartHarvesterSecurityConfiguration extends WebSecurityConfigurerAd
                 .authorizeRequests().antMatchers("/harvester/auth/**").permitAll().and()
                 .authorizeRequests().antMatchers("/resources/**", "/public/error/css/**").permitAll()
                 .antMatchers("/harvester/api/**").authenticated()
-                .antMatchers("/public/error/css/**").permitAll();
+                .antMatchers("/public/error/css/**").permitAll().and()
+                .logout().logoutSuccessHandler((req, resp, auth) -> resp.setStatus(HttpServletResponse.SC_OK));
 
         http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class);
     }
-- 
GitLab