@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/", "/images/**", "/styles.css", "/webjars/**").permitAll()
.antMatchers("/books", "/books/search").hasAnyRole("ADMIN", "CUSTOMER")
.anyRequest().hasRole("ADMIN") // ANY OTHER REQUEST NOT MATCHED ABOVE!
.and()
.formLogin()
.and()
.httpBasic();
}
Last active
February 4, 2020 16:06
-
-
Save MrSnyder/0a72a2d0eae431fa8a605307640e8658 to your computer and use it in GitHub Desktop.
Spring Security Cheatsheet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment