下面是SecurityFilterChain根据新的 Spring Security 6 / Spring boot 3 文档创建的 bean。但是,requestMatchers -> AntPathRequestMatcher -> permitAll不起作用。每个请求都达到了OncePerRequestFilter。请告诉我这是预期的结果还是出现问题。
代码:
@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
@EnableMethodSecurity
public class WebSecurityConfig {
List<String> publicApis = List.of("/generate/**", "validated/**");
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.cors()
.configurationSource(corsConfigurationSource())
.and()
.csrf()
.disable()
.formLogin()
.disable()
.httpBasic()
.disable()
.exceptionHandling()
.authenticationEntryPoint(restAuthenticationEntryPoint())
.and()
.authorizeHttpRequests(
r -> r.requestMatchers(
publicApis().stream()
.map(AntPathRequestMatcher::new)
.toArray(RequestMatcher[]::new)
)
.permitAll()
.anyRequest()
.authenticated()
)
.sessionManagement(s -> s.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.addFilterBefore(tokenAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
return http.build();
}
@Bean
public WebSecurityCustomizer webSecurityCustomizer() { …Run Code Online (Sandbox Code Playgroud) Logstashkv过滤器不包含带空格的值。请检查下面 Logstash 生成的输入和输出消息。所需的输出应包含空格。
输入消息:
key1=first value key2=second value key3=value3
Run Code Online (Sandbox Code Playgroud)
期望的输出:
{
"key1" => "first value",
"key2" => "second value",
"key3" => "value3",
"message" => "key1=first value key2=second value key3=value3"
}
Run Code Online (Sandbox Code Playgroud)
获得的输出:
{
"key1" => "first",
"key2" => "second",
"key3" => "value3",
"message" => "key1=first value key2=second value key3=value3"
}
Run Code Online (Sandbox Code Playgroud)
我需要将值中的空格包含在字段中。如何在 Logstash 中执行此操作?