package org.octopus.internal.config.security
//
//import org.springframework.context.annotation.Bean
//import org.springframework.context.annotation.Configuration
//import org.springframework.security.authentication.AuthenticationProvider
//import org.springframework.security.authorization.AuthorizationDecision
//import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity
//import org.springframework.security.config.annotation.web.builders.HttpSecurity
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
//import org.springframework.security.config.http.SessionCreationPolicy
//import org.springframework.security.web.SecurityFilterChain
//import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
//
//
//@Configuration
//@EnableWebSecurity
//@EnableMethodSecurity(securedEnabled = true)

class SecurityConfig(
//    val authenticationProvider: AuthenticationProvider,
//    val jwtAuthenticationFilter: JwtAuthenticationFilter
) {
//
//    @Bean
//    fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
//        http
//            .authorizeHttpRequests { auth ->
//                auth
//                    .requestMatchers("**").permitAll()
//                    .requestMatchers("/workers/register/**").access { authentication, _ ->
//                        AuthorizationDecision(
//                            authentication.get().isAuthenticated && authentication.get().authorities.isEmpty()
//                        )
//                    }
//                    .anyRequest().hasAnyRole(*EUserRoles.entries.map { role -> role.role }.toTypedArray())
//            }
//            .sessionManagement { session ->
//                session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
//            }
//            .authenticationProvider(authenticationProvider)
//            .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter::class.java)
//            .csrf { it.disable() }
//
//        return http.build()
//    }
}

