views:

225

answers:

1

greetings everybody iam using spring security 3 remember me service as follows

<http>
<remember-me/>
....</http>

and i want to perform some logic in the autologin so i tried to override the AbstractRememberMeServices as follows:

package com.foo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.RememberMeServices;


public abstract class AbstractRememberMeServices implements RememberMeServices{

 @Override
 public Authentication autoLogin(HttpServletRequest arg0,
   HttpServletResponse arg1) {
  System.out.println("Auto Login");
  return null;
 }

 @Override
 public void loginSuccess(HttpServletRequest arg0, HttpServletResponse arg1,
   Authentication arg2) {
  System.out.println("Login Success");

 }

}

but the autologin occurs with no action,the user auto login but the print statement is not printed? what's wrong?

+1  A: 

The fact that you have named your class AbstractRememberMeServices does not mean that every other class which was previously extending now extends your com.foo.AbstractRememberMeServices. I don't mean to be impolite, but you need to review your knowledge of Java basics.

Concerning you question, you need to write a custom org.springframework.security.web.authentication.RememberMeService implementation, configure it in Spring and register it using the services-ref attribute:

<security:remember-me services-ref="myRememberMeServices"/>
lexicore

related questions