package net.davidvoid.thor.lightning.config;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.davidvoid.thor.lightning.security.JwtAuthenticationFilter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;


@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private JwtAuthenticationFilter filter = null;
    
    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http.authorizeRequests().anyRequest().authenticated()
                .antMatchers("/users/**").permitAll().and()
                .addFilterBefore(filter, UsernamePasswordAuthenticationFilter.class);
    }
    
}
@@ -45,176 +45,8 @@
 %0D%0A%0D%0A
-import java.io.IOException;%0D%0A%0D%0Aimport javax.servlet.ServletException;%0D%0Aimport javax.servlet.http.HttpServletRequest;%0D%0Aimport javax.servlet.http.HttpServletResponse;%0D%0A%0D%0A
 impo
@@ -112,16 +112,16 @@
 ilter;%0D%0A
+
 %0D%0Aimport
@@ -459,152 +459,8 @@
 r;%0D%0A
-import org.springframework.security.core.Authentication;%0D%0Aimport org.springframework.security.web.authentication.AuthenticationSuccessHandler;%0D%0A
 impo
@@ -796,26 +796,24 @@
 xception %7B%0D%0A
-%0D%0A
         http
@@ -836,37 +836,8 @@
 ts()
-.anyRequest().authenticated()
 %0D%0A  
@@ -876,26 +876,115 @@
 rs/*
-*%22).permitAll().an
+/login%22).permitAll().antMatchers(%22/users/*/logout%22).permitAll()%0D%0A                .anyRequest().authenticate
 d()%0D
@@ -1000,16 +1000,22 @@
         
+.and()
 .addFilt

make the login and logout interface public