/** * Provides an HttpConnectorAddress for use in connecting to the desired * admin listener. * <p> * This implementation works for true admin clients and will not work * correctly for commands submitted to instances from inside the DAS. (That * is done from the implementation in ServerRemoteAdminCommand which extends * this class.) * <p> * This code constructs the HttpConnectorAddress in a way that uses either * no SSLSocketFactory (if security is off) or uses an SSLSocketFactory * linked to the asadmin truststore. * * @param host the host name to which the connection should be made * @param port the admin port on that host * @param shouldUseSecure whether SSL should be used to connect or not * @return */ protected HttpConnectorAddress getHttpConnectorAddress( final String host, final int port, final boolean shouldUseSecure) { return new HttpConnectorAddress( host, port, shouldUseSecure); }
/** * Provides an HttpConnectorAddress for use in connecting to the desired * admin listener. * <p> * This implementation works for true admin clients and will not work * correctly for commands submitted to instances from inside the DAS. (That * is done from the implementation in ServerRemoteAdminCommand which extends * this class.) * <p> * This code constructs the HttpConnectorAddress in a way that uses either * no SSLSocketFactory (if security is off) or uses an SSLSocketFactory * linked to the asadmin truststore. * * @param host the host name to which the connection should be made * @param port the admin port on that host * @param shouldUseSecure whether SSL should be used to connect or not * @return */ protected HttpConnectorAddress getHttpConnectorAddress( final String host, final int port, final boolean shouldUseSecure) { HttpConnectorAddress hca = new HttpConnectorAddress( host, port, shouldUseSecure); hca.setInteractive(interactive); return hca; }
/** * Provides an HttpConnectorAddress for use in connecting to the desired * admin listener. * <p> * This implementation works for true admin clients and will not work * correctly for commands submitted to instances from inside the DAS. (That * is done from the implementation in ServerRemoteAdminCommand which extends * this class.) * <p> * This code constructs the HttpConnectorAddress in a way that uses either * no SSLSocketFactory (if security is off) or uses an SSLSocketFactory * linked to the asadmin truststore. * * @param host the host name to which the connection should be made * @param port the admin port on that host * @param shouldUseSecure whether SSL should be used to connect or not * @return */ protected HttpConnectorAddress getHttpConnectorAddress( final String host, final int port, final boolean shouldUseSecure) { HttpConnectorAddress hca = new HttpConnectorAddress( host, port, shouldUseSecure); hca.setInteractive(interactive); return hca; }
/** * Creates a new HttpConnectorAddress corresponding to the location to which * an earlier request was redirected. * <p> * If the new protocol is https then the HttpConnectorAddress secure setting * is turned on. * @param originalAddr the address which has been redirected elsewhere * @param redirection the location to which the attempted connection was redirected * @return connector address for the new location * @throws MalformedURLException */ private HttpConnectorAddress followRedirection( final HttpConnectorAddress originalAddr, final String redirection) throws MalformedURLException { final URL url = new URL(redirection); final boolean useSecure = (url.getProtocol().equalsIgnoreCase("https")); return new HttpConnectorAddress( url.getHost(), url.getPort(), useSecure, originalAddr.getPath(), originalAddr.getSSLSocketFactory()); }
/** * Creates a new HttpConnectorAddress corresponding to the location to which * an earlier request was redirected. * <p> * If the new protocol is https then the HttpConnectorAddress secure setting * is turned on. * @param originalAddr the address which has been redirected elsewhere * @param redirection the location to which the attempted connection was redirected * @return connector address for the new location * @throws MalformedURLException */ private HttpConnectorAddress followRedirection( final HttpConnectorAddress originalAddr, final String redirection) throws MalformedURLException { final URL url = new URL(redirection); final boolean useSecure = (url.getProtocol().equalsIgnoreCase("https")); HttpConnectorAddress hca = new HttpConnectorAddress( url.getHost(), url.getPort(), useSecure, originalAddr.getPath(), originalAddr.getSSLSocketFactory()); hca.setInteractive(interactive); return hca; }
/** * Creates a new HttpConnectorAddress corresponding to the location to which * an earlier request was redirected. * <p> * If the new protocol is https then the HttpConnectorAddress secure setting * is turned on. * @param originalAddr the address which has been redirected elsewhere * @param redirection the location to which the attempted connection was redirected * @return connector address for the new location * @throws MalformedURLException */ private HttpConnectorAddress followRedirection( final HttpConnectorAddress originalAddr, final String redirection) throws MalformedURLException { final URL url = new URL(redirection); final boolean useSecure = (url.getProtocol().equalsIgnoreCase("https")); HttpConnectorAddress hca = new HttpConnectorAddress( url.getHost(), url.getPort(), useSecure, originalAddr.getPath(), originalAddr.getSSLSocketFactory()); hca.setInteractive(interactive); return hca; }
@Override protected synchronized HttpConnectorAddress getHttpConnectorAddress(String host, int port, boolean shouldUseSecure) { /* * Always use secure communication to another server process. * Return a connector address that uses a cert to authenticate this * process as a client only if a cert, rather than an admin username * and password, is used for process-to-process authentication. */ try { final String certAlias = SecureAdmin.Util.isUsingUsernamePasswordAuth(secureAdmin) ? null : getCertAlias(); return new HttpConnectorAddress(host, port, certAlias == null ? null : sslUtils().getAdminSocketFactory(certAlias, SSL_SOCKET_PROTOCOL)); } catch (Exception ex) { throw new RuntimeException(ex); } }
@Override protected synchronized HttpConnectorAddress getHttpConnectorAddress(String host, int port, boolean shouldUseSecure) { /* * Always use secure communication to another server process. * Return a connector address that uses a cert to authenticate this * process as a client only if a cert, rather than an admin username * and password, is used for process-to-process authentication. */ try { final String certAlias = SecureAdmin.Util.isUsingUsernamePasswordAuth(secureAdmin) ? null : getCertAlias(); return new HttpConnectorAddress(host, port, certAlias == null ? null : sslUtils().getAdminSocketFactory(certAlias, SSL_SOCKET_PROTOCOL)); } catch (Exception ex) { throw new RuntimeException(ex); } }
@Override protected synchronized HttpConnectorAddress getHttpConnectorAddress(String host, int port, boolean shouldUseSecure) { /* * Return a connector address that uses a cert to authenticate this * process as a client only if secure admin is enabled and if a cert, * rather than an admin username and password, are used for process-to- * process authentication. */ if (SecureAdmin.Util.isEnabled(secureAdmin) && ! SecureAdmin.Util.isUsingUsernamePasswordAuth(secureAdmin)) { return new HttpConnectorAddress(host, port, sslUtils().getAdminSocketFactory(getCertAlias(), SSL_SOCKET_PROTOCOL)); } else { return super.getHttpConnectorAddress(host, port, shouldUseSecure); } }