Class SecurityConfiguration

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

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

  • 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 - the HttpSecurity to configure.
      properties - the RestSpringProperties containing configuration properties for the security setup.
      Returns:
      a SecurityFilterChain instance 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 - the HttpSecurity to configure.
      Returns:
      a SecurityFilterChain instance configured with the specified HTTP security settings.
      Throws:
      Exception - if an error occurs during configuration.