custom authentication provider
This commit is contained in:
@@ -45,7 +45,7 @@ public class AppSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
http.authorizeRequests()
|
||||
.antMatchers("/login", "/register","/home")
|
||||
.permitAll()
|
||||
.antMatchers("/account/**").hasAuthority("CUSTOMER")
|
||||
.antMatchers("/account/**").hasAnyAuthority("CUSTOMER", "ADMIN")
|
||||
.and()
|
||||
.exceptionHandling().accessDeniedHandler(accessDeniedHandler())
|
||||
.and()
|
||||
|
||||
@@ -50,5 +50,4 @@ public class CustomUserDetailService implements UserDetailsService{
|
||||
|
||||
return authorities;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
spring.jpa.generate-ddl=true
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/spring-security-series?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=root
|
||||
spring.datasource.password=12345678
|
||||
|
||||
#disabling cache for the development purpose
|
||||
spring.template.cache=false
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</ul>
|
||||
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="dropdown user user-menu" sec:authorize="hasAuthority('CUSTOMER')">
|
||||
<li class="dropdown user user-menu" sec:authorize="hasAnyAuthority('CUSTOMER', 'ADMIN')">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<span class="hidden-xs" sec:authentication="name"></span>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user