Update HttpSecurityConfig.java

This commit is contained in:
Rufina Uche 2023-10-07 12:44:06 +01:00 committed by GitHub
parent 5446928547
commit 1b1ba05a50

View File

@ -14,16 +14,16 @@ public class HttpSecurityConfig extends WebSecurityConfigurerAdapter {
// Given: HttpSecurity configured // Given: HttpSecurity configured
http http
.authorizeRequests() .authorizeRequests()
.antMatchers("/public/**").permitAll() .antMatchers("/public/**").permitAll()
.antMatchers("/admin/**").hasRole("ADMIN") .antMatchers("/admin/**").hasRole("ADMIN")
.anyRequest().authenticated() .anyRequest().authenticated()
.and() .and()
.formLogin() .formLogin()
.loginPage("/login") .loginPage("/login")
.permitAll() .permitAll()
.and() .and()
.logout() .logout()
.permitAll(); .permitAll();
// When: Accessing specific URLs // When: Accessing specific URLs