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

com.essec.microservices.SecurityConfiguration Maven / Gradle / Ivy

Go to download

Shared configuration and tools. This project contains a custom spring boot module to facilitate new api project developpement startup process.

There is a newer version: 1.0.42
Show newest version
package com.essec.microservices;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint;

@Configuration
@Order(Ordered.LOWEST_PRECEDENCE)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

	
	@Override
	protected void configure(HttpSecurity http) throws Exception {
		http
		.csrf().disable()
		.authorizeRequests()
			.antMatchers("/**").permitAll()
			.and().httpBasic()
			.and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
	}
	
	@Bean
    public AuthenticationEntryPoint restAuthenticationEntryPoint() {
        return new Http403ForbiddenEntryPoint();
    }
	


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy