SEC-1280: NullPointerException in PersistentTokenBasedRememberMeServices when logging out twice. Added check for null authentication in logout method.
This commit is contained in:
parent
197737a2b4
commit
617e517e5e
|
@ -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];
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue