All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nz.co.katatech.springboot.security.stateless.config.StatelessSecurityConfigurer Maven / Gradle / Ivy

Go to download

Stateless security using JWT token. Includes stateless CSRF protection, integration OAuth2SSO

There is a newer version: 1.2
Show newest version
package nz.co.katatech.springboot.security.stateless.config;

import nz.co.katatech.springboot.security.stateless.HttpServletBinder;
import nz.co.katatech.springboot.security.stateless.StatelessSecurityContextRepository;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;

public class StatelessSecurityConfigurer {

    private final StatelessSecurityContextRepository repository;

    public StatelessSecurityConfigurer( StatelessSecurityContextRepository repository ) {
        this.repository = repository;
    }

    public HttpSecurity configure( HttpSecurity http ) throws Exception {
        http.csrf().disable()
            .securityContext().securityContextRepository( repository )
            .and().logout().deleteCookies( HttpServletBinder.X_AUTH_TOKEN );
        return http;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy