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,8 +142,11 @@ public class PersistentTokenBasedRememberMeServices extends AbstractRememberMeSe
@Override
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
super.logout(request, response, authentication);
if (authentication != null) {
tokenRepository.removeUserTokens(authentication.getName());
}
}
protected String generateSeriesData() {
byte[] newSeries = new byte[seriesLength];

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 {