Package com.dani.bff.config
Class SecurityConfig
java.lang.Object
com.dani.bff.config.SecurityConfig
Configures JWT resource-server security and JSON security error responses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.oauth2.jwt.ReactiveJwtDecoderreactiveJwtDecoder(JwtSecurityProperties properties) Builds a JWT decoder from JWK, issuer discovery, or local HMAC settings in that order.org.springframework.security.web.server.SecurityWebFilterChainsecurityWebFilterChain(org.springframework.security.config.web.server.ServerHttpSecurity http, com.fasterxml.jackson.databind.ObjectMapper objectMapper, boolean openApiDocsEnabled, boolean swaggerUiEnabled) Protects BFF APIs, leaves health checks public, and denies unknown routes.
-
Constructor Details
-
SecurityConfig
public SecurityConfig()
-
-
Method Details
-
securityWebFilterChain
@Bean public org.springframework.security.web.server.SecurityWebFilterChain securityWebFilterChain(org.springframework.security.config.web.server.ServerHttpSecurity http, com.fasterxml.jackson.databind.ObjectMapper objectMapper, @Value("${springdoc.api-docs.enabled:false}") boolean openApiDocsEnabled, @Value("${springdoc.swagger-ui.enabled:false}") boolean swaggerUiEnabled) Protects BFF APIs, leaves health checks public, and denies unknown routes.- Parameters:
http- Spring Security reactive HTTP builderobjectMapper- JSON serializer for authentication errorsopenApiDocsEnabled- whether the OpenAPI JSON/YAML endpoint is intentionally enabledswaggerUiEnabled- whether Springdoc Swagger UI is intentionally enabled- Returns:
- the configured security filter chain
-
reactiveJwtDecoder
@Bean public org.springframework.security.oauth2.jwt.ReactiveJwtDecoder reactiveJwtDecoder(JwtSecurityProperties properties) Builds a JWT decoder from JWK, issuer discovery, or local HMAC settings in that order.- Parameters:
properties- externalized JWT settings- Returns:
- a reactive JWT decoder used by the resource server
-