Class SecurityConfiguration

java.lang.Object
io.github.yvasyliev.forwarder.telegram.bot.configuration.SecurityConfiguration

@Configuration @EnableGlobalAuthentication @EnableMethodSecurity public class SecurityConfiguration extends Object
Security configuration for the Telegram Forwarder Bot. This class sets up the authentication manager and user details service for the application, allowing for secure access to methods and resources.
  • Constructor Details

    • SecurityConfiguration

      public SecurityConfiguration()
  • Method Details

    • authenticationManager

      @Bean public TelegramAuthenticationManager authenticationManager(org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration authConfig)
      Configures the authentication manager to allow for custom user details handling. This method sets the hideUserNotFoundExceptions property to false, enabling more informative error messages during authentication failures.
      Parameters:
      authConfig - the authentication configuration
      Returns:
      the configured authentication manager
    • userDetailsService

      @Bean public org.springframework.security.core.userdetails.UserDetailsService userDetailsService(TelegramAdminProperties adminProperties)
      Provides an in-memory user details service with an admin user. This method creates a user details manager that contains a single admin user with the ID specified in the Telegram properties.
      Parameters:
      adminProperties - the Telegram admin properties
      Returns:
      the user details service with the admin user