Commit a4aef070 by Patryk Czarnik

Reguły autoryzacji

parent bcd2a63b
...@@ -21,7 +21,14 @@ public class SecurityConfig { ...@@ -21,7 +21,14 @@ public class SecurityConfig {
@Bean @Bean
SecurityFilterChain setHttpSecurity(HttpSecurity httpSecurity) throws Exception { SecurityFilterChain setHttpSecurity(HttpSecurity httpSecurity) throws Exception {
httpSecurity.authorizeHttpRequests() httpSecurity.authorizeHttpRequests()
.anyRequest().authenticated() .antMatchers("/products/new", "/products/*/edit").hasAuthority("ROLE_manager")
.antMatchers("/alt?/**").authenticated() // zalogowany jako ktokolwiek
.antMatchers("/", "/whoami", "/*.css").permitAll()
.antMatchers("/hello", "/ktora-godzina").permitAll()
.antMatchers("/products/**", "/wyszukiwarka").permitAll()
.antMatchers("/customers/new", "/customers/*/edit").hasAuthority("ROLE_manager")
.antMatchers("/customers/**").permitAll()
.anyRequest().denyAll()
.and() .and()
.formLogin(); .formLogin();
return httpSecurity.build(); return httpSecurity.build();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment