import javax.security.auth.callback.TextOutputCallback;
import javax.security.auth.login.LoginException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.springframework.security.Authentication;
-import org.springframework.security.AuthenticationException;
import org.springframework.security.AuthenticationManager;
-import org.springframework.security.BadCredentialsException;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import org.springframework.security.providers.jaas.SecurityContextLoginModule;
public class SpringLoginModule extends SecurityContextLoginModule {
+ private final static Log log = LogFactory.getLog(SpringLoginModule.class);
+
private AuthenticationManager authenticationManager;
private Subject subject;
"Password", false);
if (callbackHandler == null) {
- // throw new LoginException("No call back handler available");
- return false;
+ throw new LoginException("No call back handler available");
+ // return false;
}
try {
callbackHandler.handle(new Callback[] { label, nameCallback,
}
}
+ @Override
+ public boolean logout() throws LoginException {
+ if (log.isDebugEnabled())
+ log.debug("Log out "
+ + subject.getPrincipals().iterator().next().getName());
+ return super.logout();
+ }
+
/**
* Register an {@link Authentication} in the security context.
*