Revert "passwordfix: This removes the password clearing from the authentication service"

This reverts commit elastic/x-pack@29462b494f.

Original commit: elastic/x-pack-elasticsearch@50e42933f0
This commit is contained in:
c-a-m 2014-09-29 10:27:16 -06:00
parent a57eae4f1f
commit bd38b5237c
1 changed files with 21 additions and 16 deletions

View File

@ -97,6 +97,7 @@ public class InternalAuthenticationService extends AbstractComponent implements
@SuppressWarnings("unchecked")
public User authenticate(String action, TransportMessage<?> message, AuthenticationToken token) throws AuthenticationException {
assert token != null : "cannot authenticate null tokens";
try {
User user = (User) message.getContext().get(USER_CTX_KEY);
if (user != null) {
return user;
@ -116,5 +117,9 @@ public class InternalAuthenticationService extends AbstractComponent implements
auditTrail.authenticationFailed(token, action, message);
}
throw new AuthenticationException("Unable to authenticate user for request");
} finally {
token.clearCredentials();
}
}
}