Greetings! I am configuring Spring Security in my ...
# spring
s
Greetings! I am configuring Spring Security in my project. In my code I am getting this error. Can someone assist me in this?
Copy code
@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
o
Good morning! Does this work for you?
Copy code
@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
s
Yes this has worked! Thank you for your response
👍 1