Removed deprecated CORS errors
This commit is contained in:
+34
-16
@@ -28,27 +28,45 @@ public class SecurityConfiguration {
|
|||||||
this.jwtAuthenticationFilter = jwtAuthenticationFilter;
|
this.jwtAuthenticationFilter = jwtAuthenticationFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Bean
|
||||||
|
// public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||||
|
// http.csrf()
|
||||||
|
// .disable()
|
||||||
|
// .authorizeHttpRequests()
|
||||||
|
// .requestMatchers("/api/hdfs/**") // Specific API endpoints that don't require authentication
|
||||||
|
// .permitAll()
|
||||||
|
// .requestMatchers("/api/**") // Other endpoints that should be open
|
||||||
|
// .permitAll()
|
||||||
|
// .anyRequest()
|
||||||
|
// .authenticated() // All other requests require authentication
|
||||||
|
// .and()
|
||||||
|
// .sessionManagement()
|
||||||
|
// .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||||
|
// .and()
|
||||||
|
// .authenticationProvider(authenticationProvider)
|
||||||
|
// .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
|
||||||
|
//
|
||||||
|
// return http.build();
|
||||||
|
// }
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||||
http.csrf()
|
return http
|
||||||
.disable()
|
.securityMatcher("/**")
|
||||||
.authorizeHttpRequests()
|
.authorizeHttpRequests(auth -> auth
|
||||||
.requestMatchers("/api/hdfs/**") // Specific API endpoints that don't require authentication
|
.requestMatchers("/api/hdfs/**", "/api/**").permitAll()
|
||||||
.permitAll()
|
.anyRequest().authenticated()
|
||||||
.requestMatchers("/api/**") // Other endpoints that should be open
|
)
|
||||||
.permitAll()
|
.sessionManagement(session -> session
|
||||||
.anyRequest()
|
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||||
.authenticated() // All other requests require authentication
|
)
|
||||||
.and()
|
|
||||||
.sessionManagement()
|
|
||||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
|
||||||
.and()
|
|
||||||
.authenticationProvider(authenticationProvider)
|
.authenticationProvider(authenticationProvider)
|
||||||
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
|
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
|
||||||
|
.csrf(csrf -> csrf.disable())
|
||||||
return http.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Bean
|
// @Bean
|
||||||
// CorsConfigurationSource corsConfigurationSource() {
|
// CorsConfigurationSource corsConfigurationSource() {
|
||||||
// CorsConfiguration configuration = new CorsConfiguration();
|
// CorsConfiguration configuration = new CorsConfiguration();
|
||||||
|
|||||||
Reference in New Issue
Block a user