Access control

Report a typo

Imagine that the security config enforces the following access rules:

Java
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
    return http
            .authorizeHttpRequests(auth -> auth
                    .requestMatchers("/products").permitAll()
                    .requestMatchers("/home").anonymous()
                    .requestMatchers("/history").hasAuthority("ROLE_ADMIN")
                    .requestMatchers("/api/*").authenticated()
                    .requestMatchers("/api/orders").hasRole("USER")
                    .requestMatchers("/**").denyAll()
            )
            .httpBasic(Customizer.withDefaults())
            .build();
}
Kotlin
@Bean
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain =
    http
        .authorizeHttpRequests { auth -> auth
            .requestMatchers("/products").permitAll()
            .requestMatchers("/home").anonymous()
            .requestMatchers("/history").hasAuthority("ROLE_ADMIN")
            .requestMatchers("/api/*").authenticated()
            .requestMatchers("/api/orders").hasRole("USER")
            .requestMatchers("/**").denyAll()
        }
        .httpBasic(Customizer.withDefaults())
        .build()
}

Select all correct statements about accessing the protected endpoints.

Select one or more options from the list
___

Create a free account to access the full topic