Reusable annotation for planner-only endpoints. Uses a HandlerInterceptor that resolves the household role from the authenticated user and throws 403 if the role doesn't match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
683 B
Java
21 lines
683 B
Java
package com.recipeapp.common;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
@Configuration
|
|
public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
|
private final HouseholdRoleInterceptor householdRoleInterceptor;
|
|
|
|
public WebMvcConfig(HouseholdRoleInterceptor householdRoleInterceptor) {
|
|
this.householdRoleInterceptor = householdRoleInterceptor;
|
|
}
|
|
|
|
@Override
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
registry.addInterceptor(householdRoleInterceptor);
|
|
}
|
|
}
|