Skip to content

Commit

Permalink
remove security hotspot
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenmodamioin2 committed Nov 21, 2024
1 parent d9dc372 commit a40b956
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/main/java/es/in2/verifier/security/CorsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ public class CorsConfig {
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();

// Allow all origins
configuration.setAllowedOrigins(List.of("*"));
// Allow all HTTP methods
// we need to allow all origins because the service is public and must be accessible from any domain.
configuration.setAllowedOriginPatterns(List.of("*"));
configuration.setAllowedMethods(List.of("GET", "POST"));
// Allow all headers
configuration.setAllowedHeaders(List.of("Content-Type"));

// We do not allow the sending of credentials to improve security
configuration.setAllowCredentials(false);

UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/health", configuration);
source.registerCorsConfiguration("/oid4vp/auth-request/**", configuration);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/es/in2/verifier/security/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws
.requestMatchers("/img/**").permitAll()
.anyRequest().authenticated()
)
//TODO Config with Sonar
.csrf(AbstractHttpConfigurer::disable)
.formLogin(AbstractHttpConfigurer::disable);
return http.build();
}
Expand Down

0 comments on commit a40b956

Please sign in to comment.