koushikkothagal / spring-security-jpa

Code for full Spring Security + JPA + MySQL tutorial: https://youtu.be/TNt3GHuayXs
181 stars 233 forks source link

Shows 403 Forbidden, even after cloning the same project. #1

Closed mahedi99 closed 4 years ago

mahedi99 commented 4 years ago

p

With the following snippet it works fine: .antMatchers("/admin")..permitAll()

However, it doesn't work whenever I check by role: .antMatchers("/admin").hasRole("ADMIN")

mahedi99 commented 4 years ago

hasAuthority() instead of hasRole() solves the problem.

Since with `hsRole()' : 'ROLE_' prefix is automatically added