add null check

This commit is contained in:
DOHA 2015-04-01 21:21:03 +02:00
parent 1bebb6354d
commit 5ab6b9e611
2 changed files with 6 additions and 2 deletions

View File

@ -14,6 +14,8 @@ public class AuthenticationFailureListener implements ApplicationListener<Authen
public void onApplicationEvent(AuthenticationFailureBadCredentialsEvent e) {
WebAuthenticationDetails auth = (WebAuthenticationDetails) e.getAuthentication().getDetails();
loginAttemptService.loginFailed(auth.getRemoteAddress());
if (auth != null) {
loginAttemptService.loginFailed(auth.getRemoteAddress());
}
}
}

View File

@ -14,6 +14,8 @@ public class AuthenticationSuccessEventListener implements ApplicationListener<A
public void onApplicationEvent(AuthenticationSuccessEvent e) {
WebAuthenticationDetails auth = (WebAuthenticationDetails) e.getAuthentication().getDetails();
loginAttemptService.loginSucceeded(auth.getRemoteAddress());
if (auth != null) {
loginAttemptService.loginSucceeded(auth.getRemoteAddress());
}
}
}