Spring Security — Redirect based on User Roles

How to redirect URL base on user roles

Cheav Sovannarith
Java Epic
1 min readOct 2, 2019

--

Security Configuration Class :

.defaultSuccessUrl(“/home”, true) // is used to redirect user to the url after the user have been authorized successfully. But since this option is not base on user roles. So we come up with other option : .successHandler(authenticationSuccessHandler)

And here is the custom configuration class :

READ MORE :

--

--