标签:
我们常见的几个功能:
@Autowired
private AuthenticationManager authenticationManager;
b. 装载rememberMeServices,注意一定要AbstractRememberMeServices,因为它能修改alwaysremember属性
@Autowired
private AbstractRememberMeServices rememberMeServices;
c. 自动登录并remember
UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(
user.getMobile(), password);
Authentication authentication = authenticationManager.authenticate(authRequest);
rememberMeServices.setAlwaysRemember(true);
rememberMeServices.loginSuccess(request, response, authentication);
2. @PreAuthorize不work的情况
不是网上搜的加上 pre-post-annotations="enabled"就完事,一定要加在你的应用程序配置里,而不是spring-security.xml里
如果不太理解是哪个文件,那么<annotation-driven>在哪个文件,你就加在哪个文件
标签:
原文地址:http://www.cnblogs.com/xxoome/p/5861435.html