Changeset a2c6c2b


Ignore:
Timestamp:
03/04/24 17:14:11 (15 months ago)
Author:
Aleksandar Panovski <apano77@…>
Branches:
main
Children:
5a9c93b
Parents:
24819a8
Message:

Authorization layer

Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/rezevirajmasa/demo/config/SecurityConfig.java

    r24819a8 ra2c6c2b  
    1212import org.springframework.security.web.SecurityFilterChain;
    1313import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
     14import org.springframework.web.cors.CorsConfiguration;
     15import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
     16import org.springframework.web.filter.CorsFilter;
    1417import org.springframework.web.servlet.config.annotation.CorsRegistry;
    1518import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
     
    3336    public void addCorsMappings(CorsRegistry registry) {
    3437        registry.addMapping("/**")
     38                .allowCredentials(true)
    3539                .allowedOrigins("http://localhost:3000") // Allow requests from this origin
    3640                .allowedMethods("GET", "POST", "PUT", "DELETE") // Allow these HTTP methods
    37                 .allowedHeaders("*"); // Allow all headers
     41                .allowedHeaders("*")
     42                .maxAge(3600L); // Allow all headers
    3843    }
    3944
Note: See TracChangeset for help on using the changeset viewer.