47 lines
1.6 KiB
Java
47 lines
1.6 KiB
Java
|
package eu.openaire.pdf_aggregation_statistics.security;
|
||
|
|
||
|
import org.springframework.context.annotation.Bean;
|
||
|
import org.springframework.context.annotation.Configuration;
|
||
|
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
||
|
import org.springframework.security.web.SecurityFilterChain;
|
||
|
|
||
|
|
||
|
@Configuration
|
||
|
@EnableWebSecurity
|
||
|
@EnableGlobalMethodSecurity (
|
||
|
securedEnabled = false, // Just for now..
|
||
|
jsr250Enabled = true,
|
||
|
prePostEnabled = true
|
||
|
)
|
||
|
public class SecurityConfiguration {
|
||
|
|
||
|
@Bean
|
||
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||
|
http
|
||
|
.headers()
|
||
|
.frameOptions()
|
||
|
.sameOrigin()
|
||
|
.and()
|
||
|
.cors()
|
||
|
.and()
|
||
|
.csrf()
|
||
|
.disable()
|
||
|
.exceptionHandling()
|
||
|
.and()
|
||
|
.sessionManagement()
|
||
|
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||
|
.and()
|
||
|
.authorizeRequests()
|
||
|
.antMatchers("/**").permitAll()
|
||
|
//.anyRequest().authenticated()
|
||
|
//.and()
|
||
|
//.requiresChannel()
|
||
|
//.anyRequest().requiresSecure()
|
||
|
;
|
||
|
return http.build();
|
||
|
}
|
||
|
|
||
|
}
|