Reputation: 13
I'm trying to use Spring Security, all worked with one role.
protected void configure(HttpSecurity http) throws Exception {
http.formLogin().loginPage("/login");
http.csrf().disable();
http.authorizeRequests().antMatchers("/index","/","/ajouterFiliere").hasRole("RM");
http.authorizeRequests().antMatchers("/index","/","/ajouterFiliere").hasRole("RF");
http.exceptionHandling().accessDeniedPage("/403");
}
its works for one role not for two role please help me and thank you
Upvotes: 1
Views: 2388
Reputation: 5786
Try:
http.authorizeRequests().antMatchers("/index","/","/ajouterFiliere").hasAnyRole("RM", "RF")
.
That should help.
Upvotes: 8