Changeset ac41d70 for ReserveNGo-backend


Ignore:
Timestamp:
01/28/25 04:42:09 (3 months ago)
Author:
Nikola Jordanoski <nikolaj_koko@…>
Branches:
master
Children:
48e50b4, e2a84e9
Parents:
0f3afae
Message:

Fully fixed security :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ReserveNGo-backend/src/main/java/mk/ukim/finki/it/reservengo/config/WebSecurityConfig.java

    r0f3afae rac41d70  
    44import org.springframework.context.annotation.Bean;
    55import org.springframework.context.annotation.Configuration;
     6import org.springframework.http.HttpMethod;
    67import org.springframework.lang.NonNull;
    78import org.springframework.security.authentication.AuthenticationProvider;
     
    3738                        .frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin))
    3839                .authorizeHttpRequests((requests) -> requests
     40                        .requestMatchers(HttpMethod.OPTIONS,"/**").permitAll()
    3941                        .requestMatchers(
    40                                 "/api/**",
     42                                "api/auth/**",
    4143                                "/h2/**",
    42                                 "/favicon.ico")
     44                                "/favicon.ico",
     45                                "/api/locals/**")
    4346                        .permitAll()
     47                        .requestMatchers("/api/customer/**").hasRole("CUSTOMER")
     48                        .requestMatchers("/api/admin/**").hasRole("ADMIN")
    4449                        .anyRequest()
    4550                        .authenticated()
     
    6166                registry.addMapping("/api/**")
    6267                        .allowedOrigins("http://localhost:5173")
    63                         .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH", "HEAD")
     68                        .allowedMethods("*")
    6469                        .allowedHeaders("*")
    6570                        .allowCredentials(true);
     
    6772        };
    6873    }
    69 
    7074}
Note: See TracChangeset for help on using the changeset viewer.