Class SecurityConfiguration
java.lang.Object
ai.yda.framework.channel.rest.spring.security.SecurityConfiguration
This is a Spring Security configuration that sets up security settings for the synchronized REST Channel.
- Since:
- 0.1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.web.SecurityFilterChaincombinedFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http, RestSpringProperties properties) This Channel security configuration is used when 'security-token' property is configured.org.springframework.security.web.SecurityFilterChaindefaultFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http, RestSpringProperties properties) This Channel security configuration is used when 'security-token' property is not configured.
-
Constructor Details
-
SecurityConfiguration
public SecurityConfiguration()Default constructor forSecurityConfiguration.
-
-
Method Details
-
combinedFilterChain
@Bean @ConditionalOnProperty(prefix="ai.yda.framework.channel.rest.spring", name="security-token") public org.springframework.security.web.SecurityFilterChain combinedFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http, RestSpringProperties properties) throws Exception 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 setting the session management creation policy to always. 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- theHttpSecurityto configure.properties- theRestSpringPropertiescontaining configuration properties for the security setup.- Returns:
- a
SecurityFilterChaininstance configured with the specified HTTP security settings. - Throws:
Exception- if an error occurs during configuration.
-
defaultFilterChain
@Bean @ConditionalOnMissingBean public org.springframework.security.web.SecurityFilterChain defaultFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http, RestSpringProperties properties) throws Exception 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- theHttpSecurityto configure.- Returns:
- a
SecurityFilterChaininstance configured with the specified HTTP security settings. - Throws:
Exception- if an error occurs during configuration.
-