Class SecurityConfiguration

java.lang.Object
ai.yda.framework.channel.rest.spring.streaming.security.SecurityConfiguration

@Configuration @EnableWebFluxSecurity public class SecurityConfiguration extends Object
This is a Web Flux Spring Security configuration that sets up security settings for the streaming REST Channel.
Since:
0.1.0
See Also:
  • Constructor Details

  • Method Details

    • filterChain

      @Bean @ConditionalOnProperty(prefix="ai.yda.framework.channel.rest.spring.streaming", name="security-token") public org.springframework.security.web.server.SecurityWebFilterChain filterChain(org.springframework.security.config.web.server.ServerHttpSecurity http, RestSpringStreamingProperties properties)
      This Channel security configuration is used when 'security-token' property is configured.

      Defines security filters, user authentication mechanisms, and authorization rules to control access to the Channel. This configuration includes settings for TokenAuthenticationFilter, HTTP security configurations such as enabling or disabling CORS, disabling CSRF, and adding the SessionHandlerFilter after an AnonymousAuthenticationWebFilter. It also specifies authorization rules: requests to the endpoint are authorized and require authentication, while all other requests are not authorized and do not require authentication.

      Parameters:
      http - the ServerHttpSecurity to configure.
      properties - the RestSpringStreamingProperties containing configuration properties for the security setup.
      Returns:
      a SecurityWebFilterChain instance configured with the specified HTTP security settings.
    • defaultFilterChain

      @Bean @ConditionalOnMissingBean public org.springframework.security.web.server.SecurityWebFilterChain defaultFilterChain(org.springframework.security.config.web.server.ServerHttpSecurity http, RestSpringStreamingProperties properties)
      This Channel security configuration is used when 'security-token' property is not configured.

      This configuration disables CSRF protection and CORS, and sets up authorization rules such that all HTTP requests are permitted without authentication.

      Parameters:
      http - the ServerHttpSecurity to configure.
      Returns:
      a SecurityWebFilterChain instance configured with the specified HTTP security settings.