Some of our common features:
- Sign in directly after registration, and Remember-me
This is found on the Internet many registered after login, but remember-me not.
In fact, the solution is more convenient to see the source code.
A. Loading AuthenticationManager
@Autowired
private AuthenticationManager AuthenticationManager;
B. Load remembermeservices, note Be sure to abstractremembermeservices, because it can modify the Alwaysremember property
@Autowired
private abstractremembermeservices remembermeservices;
C. Automatic Login and remember
Usernamepasswordauthenticationtoken authrequest = new Usernamepasswordauthenticationtoken (
user.getmobile (), password);
Authentication authentication = authenticationmanager.authenticate (authrequest);
Remembermeservices.setalwaysremember (true);
remembermeservices. loginsuccess (Request, response, authentication);
2. @PreAuthorize non-work situation
Not online search plus pre-post-annotations="Enabled" is done, be sure to add in your application configuration, not spring-security.xml
If you don't quite understand which file it is, then <annotation-driven> in which file you add in which file
Spring Securiy Usage Summary