Class SecurityConfig

java.lang.Object
com.dani.bff.config.SecurityConfig

@Configuration @EnableWebFluxSecurity public class SecurityConfig extends Object
Configures JWT resource-server security and JSON security error responses.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.oauth2.jwt.ReactiveJwtDecoder
    Builds a JWT decoder from JWK, issuer discovery, or local HMAC settings in that order.
    org.springframework.security.web.server.SecurityWebFilterChain
    securityWebFilterChain(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 builder
      objectMapper - JSON serializer for authentication errors
      openApiDocsEnabled - whether the OpenAPI JSON/YAML endpoint is intentionally enabled
      swaggerUiEnabled - 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