Sheheryar Umair
02/14/2024, 6:55 AM@Bean
@Throws(Exception::class)
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain? {
return http.csrf { obj: CsrfConfigurer<HttpSecurity> -> obj.disable() }
.authorizeHttpRequests(
Customizer { auth: AuthorizationManagerRequestMatcherRegistry ->
auth.requestMatchers("/users/hello").permitAll()
.requestMatchers("/users/**")
.authenticated()
}
)
.httpBasic(Customizer.withDefaults()).build()
}
The error is
Type arguments should be specified for an outer class 'AuthorizeHttpRequestsConfigurer'. Use full class name to specify them
Okizuys
02/14/2024, 8:20 AM@Bean
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain? {
return http.csrf { obj: CsrfConfigurer<HttpSecurity> -> obj.disable() }
.authorizeHttpRequests { auth: AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry ->
auth.requestMatchers("/users/hello").permitAll()
.requestMatchers("/users/**")
.authenticated()
}
.httpBasic(Customizer.withDefaults()).build()
}
AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry
instead of just AuthorizationManagerRequestMatcherRegistry
Sheheryar Umair
02/14/2024, 8:24 AM