} else { log.tracef("Handling AuthenticationCompleteCallback: fail"); fail();
private SecurityIdentity authenticate(final String username, final String password) { ServerAuthenticationContext context = this.securityDomain.createNewAuthenticationContext(); PasswordGuessEvidence evidence = new PasswordGuessEvidence(password != null ? password.toCharArray() : null); try { context.setAuthenticationName(username); if (context.verifyEvidence(evidence)) { if (context.authorize()) { context.succeed(); return context.getAuthorizedIdentity(); } else { context.fail(); WSLogger.ROOT_LOGGER.failedAuthorization(username); } } else { context.fail(); WSLogger.ROOT_LOGGER.failedAuthentication(username); } } catch (IllegalArgumentException | IllegalStateException | RealmUnavailableException e) { context.fail(); WSLogger.ROOT_LOGGER.failedAuthenticationWithException(e, username, e.getMessage()); } finally { if (!context.isDone()) context.fail(); //prevent leaks of RealmIdentity instances evidence.destroy(); } return null; }
private SecurityIdentity authenticate(final String username, final String password) { ServerAuthenticationContext context = this.securityDomain.createNewAuthenticationContext(); PasswordGuessEvidence evidence = new PasswordGuessEvidence(password != null ? password.toCharArray() : null); try { context.setAuthenticationName(username); if (context.verifyEvidence(evidence)) { if (context.authorize()) { context.succeed(); return context.getAuthorizedIdentity(); } else { context.fail(); WSLogger.ROOT_LOGGER.failedAuthorization(username); } } else { context.fail(); WSLogger.ROOT_LOGGER.failedAuthentication(username); } } catch (IllegalArgumentException | IllegalStateException | RealmUnavailableException e) { context.fail(); WSLogger.ROOT_LOGGER.failedAuthenticationWithException(e, username, e.getMessage()); } finally { if (!context.isDone()) context.fail(); //prevent leaks of RealmIdentity instances evidence.destroy(); } return null; }
return context.getAuthorizedIdentity(); } else { context.fail(); return null; context.fail(); return null; context.fail(); MessagingLogger.ROOT_LOGGER.failedAuthorization(username); context.fail(); MessagingLogger.ROOT_LOGGER.failedAuthentication(username); context.fail(); MessagingLogger.ROOT_LOGGER.failedAuthenticationWithException(e, username, e.getMessage()); } finally {
return context.getAuthorizedIdentity(); } else { context.fail(); return null; context.fail(); return null; context.fail(); MessagingLogger.ROOT_LOGGER.failedAuthorization(username); context.fail(); MessagingLogger.ROOT_LOGGER.failedAuthentication(username); context.fail(); MessagingLogger.ROOT_LOGGER.failedAuthenticationWithException(e, username, e.getMessage()); } finally {
} else { log.tracef("Handling AuthenticationCompleteCallback: fail"); fail();
} else { log.tracef("Handling AuthenticationCompleteCallback: fail"); fail();
} else { log.tracef("Handling AuthenticationCompleteCallback: fail"); fail();