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

com.fivefaces.structureclient.config.security.patient.OpenToPublicSecurityConfig Maven / Gradle / Ivy

There is a newer version: 1.0.62
Show newest version
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();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy