您可以执行以下 *** 作:
public class Test implements AuthenticationSuccessHandler { public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { Set<String> roles = AuthorityUtils.authorityListToSet(authentication.getAuthorities()); if (roles.contains("ROLE_USER") { response.sendRedirect("/userpage"); } }}
<bean id="authenticationFilter" > <!-- There might be more properties here, depending on your auth filter!! --> <property name="authenticationSuccessHandler" ref="successHandler" /></bean><bean id="successHandler" />
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)