1.1.34.10.1. fejezet, Memóriában tárolt felhasználói adatok
Beküldte pzoli - 2024, június 12 - 8:57de
@Configuration @EnableWebSecurity @EnableMethodSecurity class SecurityConfig { @Bean fun defaultSecurityFilterChain(http:HttpSecurity): SecurityFilterChain { http.authorizeHttpRequests{request-> request .requestMatchers("/swagger-ui/**").permitAll() .requestMatchers("/v3/api-docs/**").permitAll() .anyRequest().authenticated()} http.sessionManagement{session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)} //http.formLogin(Customizer.withDefaults()) http.httpBasic(Customizer.withDefaults()) return http.build() } @Bean fun userDetailService():UserDetailsService { val user = User.withUsername("pzoli").password("{noop}q").roles("USER").build() val admin = User.withUsername("admin").password("{noop}admin123").roles("ADMIN").build() return InMemoryUserDetailsManager(user,admin) } }
- A hozzászóláshoz be kell jelentkezni