Class SecurityConfiguration
java.lang.Object
ai.yda.framework.channel.rest.spring.streaming.security.SecurityConfiguration
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.web.server.SecurityWebFilterChaindefaultFilterChain(org.springframework.security.config.web.server.ServerHttpSecurity http, RestSpringStreamingProperties properties) This Channel security configuration is used when 'security-token' property is not configured.org.springframework.security.web.server.SecurityWebFilterChainfilterChain(org.springframework.security.config.web.server.ServerHttpSecurity http, RestSpringStreamingProperties properties) This Channel security configuration is used when 'security-token' property is configured.
-
Constructor Details
-
SecurityConfiguration
public SecurityConfiguration()Default constructor forSecurityConfiguration.
-
-
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 theSessionHandlerFilterafter 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- theServerHttpSecurityto configure.properties- theRestSpringStreamingPropertiescontaining configuration properties for the security setup.- Returns:
- a
SecurityWebFilterChaininstance 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- theServerHttpSecurityto configure.- Returns:
- a
SecurityWebFilterChaininstance configured with the specified HTTP security settings.
-