web/src/main/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServices.java
@Override
	public final Authentication autoLogin(HttpServletRequest request,
			HttpServletResponse response) {
		String rememberMeCookie = extractRememberMeCookie(request);

		if (rememberMeCookie == null) {
			return null;
		}

		logger.debug("Remember-me cookie detected");

		if (rememberMeCookie.length() == 0) {
			logger.debug("Cookie was empty");
			cancelCookie(request, response);
			return null;
		}

		UserDetails user = null;

		try {
			String[] cookieTokens = decodeCookie(rememberMeCookie);
			user = processAutoLoginCookie(cookieTokens, request, response);
			userDetailsChecker.check(user);

			logger.debug("Remember-me cookie accepted");

			return createSuccessfulAuthentication(request, user);
		}
		catch (CookieTheftException cte) {
			cancelCookie(request, response);
			throw cte;
		}
		catch (UsernameNotFoundException noUser) {
			logger.debug("Remember-me login was valid but corresponding user not found.",
					noUser);
		}
		catch (InvalidCookieException invalidCookie) {
			logger.debug("Invalid remember-me cookie: " + invalidCookie.getMessage());
		}
		catch (AccountStatusException statusInvalid) {
			logger.debug("Invalid UserDetails: " + statusInvalid.getMessage());
		}
		catch (RememberMeAuthenticationException e) {
			logger.debug(e.getMessage());
		}

		cancelCookie(request, response);
		return null;
	}
@Override
	public final Authentication autoLogin(HttpServletRequest request,
			HttpServletResponse response) {
		String rememberMeCookie = extractRememberMeCookie(request);

		if (rememberMeCookie == null) {
			return null;
		}

		logger.debug("Remember-me cookie detected");

		if (rememberMeCookie.length() == 0) {
			logger.debug("Cookie was empty");
			cancelCookie(request, response);
			return null;
		}

		UserDetails user = null;

		try {
			String[] cookieTokens = decodeCookie(rememberMeCookie);
			user = processAutoLoginCookie(cookieTokens, request, response);
			userDetailsChecker.check(user);

			logger.debug("Remember-me cookie accepted");

			return createSuccessfulAuthentication(request, user);
		}
		catch (CookieTheftException cte) {
			cancelCookie(request, response);
			throw cte;
		}
		catch (UsernameNotFoundException noUser) {
			logger.debug("Remember-me login was valid but corresponding user not found.",
					noUser);
		}
		catch (InvalidCookieException invalidCookie) {
			logger.debug("Invalid remember-me cookie: " + invalidCookie.getMessage());
		}
		catch (AccountStatusException statusInvalid) {
			logger.debug("Invalid UserDetails: " + statusInvalid.getMessage());
		}
		catch (RememberMeAuthenticationException e) {
			logger.debug(e.getMessage());
		}

		cancelCookie(request, response);
		return null;
	}
@ Override public final Authentication autoLogin ( HttpServletRequest request , HttpServletResponse response ) { String rememberMeCookie = extractRememberMeCookie ( request ) ; if ( rememberMeCookie == null ) { return null ; } logger . debug ( "Remember-me cookie detected" ) ; if ( rememberMeCookie . length ( ) == 0 ) { logger . debug ( "Cookie was empty" ) ; cancelCookie ( request , response ) ; return null ; } UserDetails user = null ; try { String [ ] cookieTokens = decodeCookie ( rememberMeCookie ) ; user = processAutoLoginCookie ( cookieTokens , request , response ) ; userDetailsChecker . check ( user ) ; logger . debug ( "Remember-me cookie accepted" ) ; return createSuccessfulAuthentication ( request , user ) ; } catch ( CookieTheftException cte ) { cancelCookie ( request , response ) ; throw cte ; } catch ( UsernameNotFoundException noUser ) { logger . debug ( "Remember-me login was valid but corresponding user not found." , noUser ) ; } catch ( InvalidCookieException invalidCookie ) { logger . debug ( "Invalid remember-me cookie: " + invalidCookie . getMessage ( ) ) ; } catch ( AccountStatusException statusInvalid ) { logger . debug ( "Invalid UserDetails: " + statusInvalid . getMessage ( ) ) ; } catch ( RememberMeAuthenticationException e ) { logger . debug ( e . getMessage ( ) ) ; } cancelCookie ( request , response ) ; return null ; }
Template implementation which locates the Spring Security cookie, decodes it into a
delimited array of tokens and submits it to subclasses for processing via the
<tt>processAutoLoginCookie</tt> method.
<p>
The returned username is then used to load the UserDetails object for the user,
which in turn is used to create a valid authentication token.
Template implementation which locates the Spring Security cookie decodes it into a delimited array of tokens and submits it to subclasses for processing via the <tt > processAutoLoginCookie< / tt > method . <p > The returned username is then used to load the UserDetails object for the user which in turn is used to create a valid authentication token .