authorizeHttpRequests
Allows restricting access based upon the HttpServletRequest
Example:
@Configuration
@EnableWebSecurity
class SecurityConfig {
@Bean
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
http {
authorizeHttpRequests {
authorize("/public", permitAll)
authorize(anyRequest, authenticated)
}
}
return http.build()
}
}Content copied to clipboard
Since
5.7
Parameters
authorizeHttpRequestsConfiguration
custom configuration that specifies access for requests