com.fivefaces.structureclient.config.security.patient.OpenToPublicSecurityConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-structure-client Show documentation
Show all versions of common-structure-client Show documentation
structure Client for Five Faces
package com.fivefaces.structureclient.config.security.patient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
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.web.cors.CorsConfigurationSource;
@Configuration
@Order(1)
@Slf4j
@RequiredArgsConstructor
public class OpenToPublicSecurityConfig extends WebSecurityConfigurerAdapter {
private final CorsConfigurationSource corsConfigurationSource;
protected void configure(HttpSecurity http) throws Exception {
http.cors().configurationSource(corsConfigurationSource);
http.antMatcher("/pt-auth/**")
.cors().configurationSource(corsConfigurationSource).and()
.authorizeRequests()
.antMatchers("/pt-auth/**").permitAll()
.and().csrf().disable();
http.antMatcher("/health-check/**")
.cors().configurationSource(corsConfigurationSource).and()
.authorizeRequests()
.antMatchers("/health-check/**").permitAll()
.and().csrf().disable();
http.antMatcher("/utils/**")
.cors().configurationSource(corsConfigurationSource).and()
.authorizeRequests()
.antMatchers("/utils/**").permitAll()
.and().csrf().disable();
}
}