Skip to content

Commit 8987793

Browse files
committed
Add MethodSecurityConfig to enable method-level security for non-dev profiles
1 parent 2ee9762 commit 8987793

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.example.evidence.config;
2+
3+
import org.springframework.context.annotation.Configuration;
4+
import org.springframework.context.annotation.Profile;
5+
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
6+
7+
/**
8+
* Enables @PreAuthorize method-level security only for non-dev profiles.
9+
* In dev profile, all endpoints are open for exploration before Entra ID setup.
10+
*/
11+
@Configuration
12+
@Profile("!dev")
13+
@EnableMethodSecurity
14+
public class MethodSecurityConfig {
15+
}

sample-app/api/src/main/java/com/example/evidence/config/SecurityConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.stream.Collectors;
2222

2323
@Configuration
24-
@EnableMethodSecurity
2524
public class SecurityConfig {
2625

2726
@Value("${app.cors.allowed-origins:http://localhost:4200}")

0 commit comments

Comments
 (0)