/** * Get the message for this exception, formatted with the callback. * * @return the message for this exception, with the callback (not {@code null}) */ public String getMessage() { final String message = super.getMessage(); return message != null ? String.format("%s: %s", getCallback(), message) : String.valueOf(getCallback()); } }
throw new LoginException(ioe.getMessage()); } catch (UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " not available to obtain information from user");
private void handle(final Callback[] callbacks) throws LoginException { try { AuthorizingCallbackHandler callbackHandler = getCallbackHandler(); callbackHandler.handle(callbacks); } catch (IOException e) { throw SecurityLogger.ROOT_LOGGER.failureCallingSecurityRealm(e.getMessage()); } catch (UnsupportedCallbackException e) { throw SecurityLogger.ROOT_LOGGER.failureCallingSecurityRealm(e.getMessage()); } }
/** * Overriding to allow for certificate-based login. Standard JAAS. */ @Override public boolean login() throws LoginException { Callback[] callbacks = new Callback[1]; callbacks[0] = new CertificateCallback(); try { callbackHandler.handle(callbacks); } catch (IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " Unable to obtain client certificates."); } X509Certificate[] certificates = ((CertificateCallback)callbacks[0]).getCertificates(); username = getUserNameForCertificates(certificates); if (username == null) { throw new FailedLoginException("No user for client certificate: " + getDistinguishedName(certificates)); } if (debug) { LOG.debug("Certificate for user: " + username); } succeeded = true; return true; }
} catch (UnsupportedCallbackException ucex) { if ((cbh instanceof LibPQFactory.ConsoleCallbackHandler) && ("Console is not available".equals(ucex.getMessage()))) { error = new PSQLException(GT .tr("Could not read password for SSL key file, console is not available."),
private UserData getUserData() throws LoginException { final Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("Username: "); callbacks[1] = new PasswordCallback("Password: ", false); try { this.callbackHandler.handle(callbacks); } catch (final IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (final UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " not available to obtain information from user"); } final String user = ((NameCallback) callbacks[0]).getName(); char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword(); if (tmpPassword == null) { tmpPassword = new char[0]; } final String password = new String(tmpPassword); return new UserData(user, password); }
private UserData getUserData() throws LoginException { final Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("Username: "); callbacks[1] = new PasswordCallback("Password: ", false); try { this.callbackHandler.handle(callbacks); } catch (final IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (final UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " not available to obtain information from user"); } final String user = ((NameCallback) callbacks[0]).getName(); char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword(); if (tmpPassword == null) { tmpPassword = new char[0]; } final String password = new String(tmpPassword); return new UserData(user, password); }
/** * Get the message for this exception, formatted with the callback. * * @return the message for this exception, with the callback (not {@code null}) */ public String getMessage() { final String message = super.getMessage(); return message != null ? String.format("%s: %s", getCallback(), message) : String.valueOf(getCallback()); } }
private UserData getUserData() throws LoginException { final Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("Username: "); callbacks[1] = new PasswordCallback("Password: ", false); try { this.callbackHandler.handle(callbacks); } catch (final IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (final UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " not available to obtain information from user"); } final String user = ((NameCallback) callbacks[0]).getName(); char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword(); if (tmpPassword == null) { tmpPassword = new char[0]; } final String password = new String(tmpPassword); return new UserData(user, password); }
private UserData getUserData() throws LoginException { final Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("Username: "); callbacks[1] = new PasswordCallback("Password: ", false); try { this.callbackHandler.handle(callbacks); } catch (final IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (final UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " not available to obtain information from user"); } final String user = ((NameCallback) callbacks[0]).getName(); char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword(); if (tmpPassword == null) { tmpPassword = new char[0]; } final String password = new String(tmpPassword); return new UserData(user, password); }
/** * Get the message for this exception, formatted with the callback. * * @return the message for this exception, with the callback (not {@code null}) */ public String getMessage() { final String message = super.getMessage(); return message != null ? String.format("%s: %s", getCallback(), message) : String.valueOf(getCallback()); } }
/** * Get the message for this exception, formatted with the callback. * * @return the message for this exception, with the callback (not {@code null}) */ public String getMessage() { final String message = super.getMessage(); return message != null ? String.format("%s: %s", getCallback(), message) : String.valueOf(getCallback()); } }
@Override public boolean login() throws LoginException { Callback[] callbacks = new Callback[2]; callbacks[0] = new NameCallback("login"); callbacks[1] = new PasswordCallback("password", true); try { handler.handle(callbacks); String name = ((NameCallback) callbacks[0]).getName(); String password = String.valueOf(((PasswordCallback) callbacks[1]).getPassword()); if (name != null && password != null) { String basicAuthHeader = "Basic " + Base64.getEncoder().encodeToString((name + ":" + password).getBytes("UTF-8")); principal = new BasicAuthorizationPrincipal(basicAuthHeader); return true; } throw new LoginException("Unable to proceed as there is no username or password given"); } catch (IOException e) { throw new LoginException(e.getMessage()); } catch (UnsupportedCallbackException e) { throw new LoginException(e.getMessage()); } }
@Override public boolean login() throws LoginException { Callback[] callbacks = new Callback[1]; callbacks[0] = new Krb5Callback(); try { callbackHandler.handle(callbacks); Principal principal = ((Krb5Callback)callbacks[0]).getPeerPrincipal(); if (principal != null) { principals.add(principal); } } catch (IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " not available to obtain information from user"); } if (!principals.isEmpty()) { loginSucceeded = true; } logger.debug("login " + principals); return loginSucceeded; }
private void handle(final Callback[] callbacks) throws LoginException { try { AuthorizingCallbackHandler callbackHandler = getCallbackHandler(); callbackHandler.handle(callbacks); } catch (IOException e) { throw SecurityMessages.MESSAGES.failureCallingSecurityRealm(e.getMessage()); } catch (UnsupportedCallbackException e) { throw SecurityMessages.MESSAGES.failureCallingSecurityRealm(e.getMessage()); } }
private void handle(final Callback[] callbacks) throws LoginException { try { AuthorizingCallbackHandler callbackHandler = getCallbackHandler(); callbackHandler.handle(callbacks); } catch (IOException e) { throw SecurityLogger.ROOT_LOGGER.failureCallingSecurityRealm(e.getMessage()); } catch (UnsupportedCallbackException e) { throw SecurityLogger.ROOT_LOGGER.failureCallingSecurityRealm(e.getMessage()); } }
private void handle(final Callback[] callbacks) throws LoginException { try { AuthorizingCallbackHandler callbackHandler = getCallbackHandler(); callbackHandler.handle(callbacks); } catch (IOException e) { throw SecurityMessages.MESSAGES.failureCallingSecurityRealm(e.getMessage()); } catch (UnsupportedCallbackException e) { throw SecurityMessages.MESSAGES.failureCallingSecurityRealm(e.getMessage()); } }
/** * Overriding to allow for certificate-based login. Standard JAAS. */ @Override public boolean login() throws LoginException { Callback[] callbacks = new Callback[1]; callbacks[0] = new CertificateCallback(); try { callbackHandler.handle(callbacks); } catch (IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (UnsupportedCallbackException uce) { throw new LoginException("Unable to obtain client certificates: " + uce.getMessage()); } certificates = ((CertificateCallback) callbacks[0]).getCertificates(); username = getUserNameForCertificates(certificates); if (username == null) { throw new FailedLoginException("No user for client certificate: " + getDistinguishedName(certificates)); } if (debug) { logger.debug("Certificate for user: " + username); } return true; }
/** * Overriding to allow for certificate-based login. Standard JAAS. */ @Override public boolean login() throws LoginException { Callback[] callbacks = new Callback[1]; callbacks[0] = new CertificateCallback(); try { callbackHandler.handle(callbacks); } catch (IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " Unable to obtain client certificates."); } certificates = ((CertificateCallback)callbacks[0]).getCertificates(); username = getUserNameForCertificates(certificates); if (username == null) { throw new FailedLoginException("No user for client certificate: " + getDistinguishedName(certificates)); } if (debug) { LOG.debug("Certificate for user: " + username); } return true; }
/** * Overriding to allow for certificate-based login. Standard JAAS. */ @Override public boolean login() throws LoginException { Callback[] callbacks = new Callback[1]; callbacks[0] = new CertificateCallback(); try { callbackHandler.handle(callbacks); } catch (IOException ioe) { throw new LoginException(ioe.getMessage()); } catch (UnsupportedCallbackException uce) { throw new LoginException(uce.getMessage() + " Unable to obtain client certificates."); } certificates = ((CertificateCallback)callbacks[0]).getCertificates(); username = getUserNameForCertificates(certificates); if (username == null) { throw new FailedLoginException("No user for client certificate: " + getDistinguishedName(certificates)); } if (debug) { LOG.debug("Certificate for user: " + username); } return true; }