|
@@ -1,6 +1,7 @@
|
|
|
package pl.sudra.configuration;
|
|
package pl.sudra.configuration;
|
|
|
|
|
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
|
|
+import jakarta.servlet.DispatcherType;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
|
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
|
@@ -70,6 +71,8 @@ public class SecurityConfiguration {
|
|
|
|
|
|
|
|
http
|
|
http
|
|
|
.authorizeHttpRequests((authz) -> authz
|
|
.authorizeHttpRequests((authz) -> authz
|
|
|
|
|
+ .dispatcherTypeMatchers(DispatcherType.FORWARD).permitAll()
|
|
|
|
|
+ .requestMatchers("/resources/**").permitAll()
|
|
|
.requestMatchers("/appUsers*").hasRole("ADMIN")
|
|
.requestMatchers("/appUsers*").hasRole("ADMIN")
|
|
|
.requestMatchers("/appUserRole*").hasRole("ADMIN")
|
|
.requestMatchers("/appUserRole*").hasRole("ADMIN")
|
|
|
.requestMatchers("/exampleOne").hasAuthority("ROLE_USER")
|
|
.requestMatchers("/exampleOne").hasAuthority("ROLE_USER")
|
|
@@ -77,6 +80,7 @@ public class SecurityConfiguration {
|
|
|
.requestMatchers("/exampleThree").hasRole("STUDENT")
|
|
.requestMatchers("/exampleThree").hasRole("STUDENT")
|
|
|
.requestMatchers("/login*").anonymous()
|
|
.requestMatchers("/login*").anonymous()
|
|
|
.requestMatchers("/appUserRest/*").anonymous()
|
|
.requestMatchers("/appUserRest/*").anonymous()
|
|
|
|
|
+ .requestMatchers("/css_login").anonymous()
|
|
|
.anyRequest().authenticated()
|
|
.anyRequest().authenticated()
|
|
|
)
|
|
)
|
|
|
// .formLogin(form -> form
|
|
// .formLogin(form -> form
|