try {
LOGGER.debug("Attempting login for user {}", username);
identity = this.provider.logonUser(username, new String(token.getPassword()));
if (identity.isGuest()) {
LOGGER.debug("Guest identity for user {}; denying access", username);
throw new AuthenticationException("Guest identities are not allowed access");
}
final Object principal = new WaffleFqnPrincipal(identity);
authenticationInfo = buildAuthenticationInfo(token, principal);
LOGGER.debug("Successful login for user {}", username);
} catch (RuntimeException e) {
LOGGER.debug("Failed login for user {}: {}", username, e.getMessage());
LOGGER.trace("{}", e);
throw new AuthenticationException("Login failed", e);
} finally {
if (identity != null) {
identity.dispose();
}
}