Add OpenAPI documentation generation and update security configuration
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good

This commit is contained in:
2025-12-24 00:35:05 +01:00
parent 0a78c302d4
commit 3ea13530bc
6 changed files with 705 additions and 1 deletions
@@ -88,13 +88,13 @@ public class SecurityConfiguration {
.cors(withDefaults())
//.authorizeHttpRequests(auth -> auth.anyRequest().permitAll()) //allows Access To ALL APIs, Security is off
.authorizeHttpRequests(auth -> {
auth.requestMatchers(AUTH_WHITELIST).permitAll();
auth.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll();
auth.requestMatchers("/auth/user/**").permitAll();
auth.requestMatchers("/admin/**").hasRole("ADMIN"); //looks for "ROLE_ADMIN" //alternative: hasAuthoritiy("ADMIN")
auth.requestMatchers("/user/**").hasAnyRole("ADMIN", "USER");
auth.requestMatchers("/friendship/**").hasAnyRole("ADMIN", "USER");
auth.requestMatchers("/trip/**").hasAnyRole("USER", "ADMIN");
auth.requestMatchers(AUTH_WHITELIST).permitAll();
//auth.requestMatchers("/error").permitAll();
auth.anyRequest().authenticated();