@Override
public Subject login(Subject subject, final AuthenticationToken token) throws AuthenticationException {
try {
subject = super.login(subject, token);
UserIdMdcHelper.set(subject);
eventBus.get().post(new AuthenticationEvent(token.getPrincipal().toString(), true));
return subject;
}
catch (AuthenticationException e) {
eventBus.get().post(new AuthenticationEvent(token.getPrincipal().toString(), false));
throw e;
}
}