SEC-1280: NullPointerException in PersistentTokenBasedRememberMeServices when logging out twice. Added check for null authentication in logout method.

This commit is contained in:
Luke Taylor 2009-11-04 17:20:13 +00:00
parent 197737a2b4
commit 617e517e5e
2 changed files with 7 additions and 1 deletions

View File

@ -142,7 +142,10 @@ public class PersistentTokenBasedRememberMeServices extends AbstractRememberMeSe
@Override
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
super.logout(request, response, authentication);
tokenRepository.removeUserTokens(authentication.getName());
if (authentication != null) {
tokenRepository.removeUserTokens(authentication.getName());
}
}
protected String generateSeriesData() {

View File

@ -121,6 +121,9 @@ public class PersistentTokenBasedRememberMeServicesTests {
Cookie returnedCookie = response.getCookie("mycookiename");
assertNotNull(returnedCookie);
assertEquals(0, returnedCookie.getMaxAge());
// SEC-1280
services.logout(request, response, null);
}
private class MockTokenRepository implements PersistentTokenRepository {