/** * Gets the host name or IP address this server's insecure port is bound to. * * @return The address. */ public final String getInsecurePortBindAddress() { return getConfig().getInsecurePortBindAddress(); }
/** * Checks if this service will bind to the insecure port during startup. * <p> * Subclasses may override this method in order to do more sophisticated checks. * * @return {@code true} if the insecure port has been enabled on <em>config</em>. */ protected boolean isInsecurePortEnabled() { return getConfig().isInsecurePortEnabled(); }
/** * Gets the host name or IP address this server's secure port is bound to. * * @return The address. */ public final String getBindAddress() { return getConfig().getBindAddress(); }
/** * Checks if this service has been configured to bind to the secure port during startup. * <p> * Subclasses may override this method in order to do more sophisticated checks. * * @return {@code true} if <em>config</em> contains a valid key and certificate. */ protected boolean isSecurePortEnabled() { return getConfig().getKeyCertOptions() != null; }
/** * Gets the host name or IP address this server's secure port is bound to. * * @return The address. */ public final String getBindAddress() { return getConfig().getBindAddress(); }
/** * Gets the host name or IP address this server's insecure port is bound to. * * @return The address. */ public final String getInsecurePortBindAddress() { return getConfig().getInsecurePortBindAddress(); }
/** * Checks if this service has been configured to bind to the secure port during startup. * <p> * Subclasses may override this method in order to do more sophisticated checks. * * @return {@code true} if <em>config</em> contains a valid key and certificate. */ protected boolean isSecurePortEnabled() { return getConfig().getKeyCertOptions() != null; }
/** * Checks if this service will bind to the insecure port during startup. * <p> * Subclasses may override this method in order to do more sophisticated checks. * * @return {@code true} if the insecure port has been enabled on <em>config</em>. */ protected boolean isInsecurePortEnabled() { return getConfig().isInsecurePortEnabled(); }
/** * Gets the options for configuring the server side trust anchor. * <p> * This default implementation returns the options returned by * {@link AbstractConfig#getTrustOptions()}. * <p> * Subclasses may override this method in order to e.g. use a * non-key store based trust manager. * * @return The trust options or {@code null} if authentication of devices * based on certificates should be disabled. */ protected TrustOptions getServerTrustOptions() { return getConfig().getTrustOptions(); }
/** * Gets the options for configuring the server side trust anchor. * <p> * This default implementation returns the options returned by * {@link AbstractConfig#getTrustOptions()}. * <p> * Subclasses may override this method in order to e.g. use a * non-key store based trust manager. * * @return The trust options or {@code null} if authentication of devices * based on certificates should be disabled. */ protected TrustOptions getServerTrustOptions() { return getConfig().getTrustOptions(); }
/** * Determines the insecure port to bind to. * <p> * The port is determined by invoking {@code HonoConfigProperties#getInsecurePort(int)} * with the value returned by {@link #getInsecurePortDefaultValue()}. * * @return The port. */ protected final int determineInsecurePort() { final int insecurePort = getConfig().getInsecurePort(getInsecurePortDefaultValue()); if (insecurePort == 0) { LOG.info("Server found insecure port number configured for ephemeral port selection (port chosen automatically)."); } else if (insecurePort == getInsecurePortDefaultValue()) { LOG.info("Server uses standard insecure port {}", insecurePort); } else if (insecurePort == getPortDefaultValue()) { LOG.warn("Server found insecure port number configured to standard port for secure connections {}", getConfig().getInsecurePort()); LOG.warn("Possibly misconfigured?"); } return insecurePort; }
/** * Determines the secure port to bind to. * <p> * The port is determined by invoking {@code HonoConfigProperties#getPort(int)} * with the value returned by {@link #getPortDefaultValue()}. * * @return The port. */ protected final int determineSecurePort() { final int port = getConfig().getPort(getPortDefaultValue()); if (port == getPortDefaultValue()) { LOG.info("Server uses secure standard port {}", port); } else if (port == 0) { LOG.info("Server found secure port number configured for ephemeral port selection (port chosen automatically)."); } return port; }
/** * Determines the secure port to bind to. * <p> * The port is determined by invoking {@code HonoConfigProperties#getPort(int)} * with the value returned by {@link #getPortDefaultValue()}. * * @return The port. */ protected final int determineSecurePort() { final int port = getConfig().getPort(getPortDefaultValue()); if (port == getPortDefaultValue()) { LOG.info("Server uses secure standard port {}", port); } else if (port == 0) { LOG.info("Server found secure port number configured for ephemeral port selection (port chosen automatically)."); } return port; }
/** * Determines the insecure port to bind to. * <p> * The port is determined by invoking {@code HonoConfigProperties#getInsecurePort(int)} * with the value returned by {@link #getInsecurePortDefaultValue()}. * * @return The port. */ protected final int determineInsecurePort() { final int insecurePort = getConfig().getInsecurePort(getInsecurePortDefaultValue()); if (insecurePort == 0) { LOG.info("Server found insecure port number configured for ephemeral port selection (port chosen automatically)."); } else if (insecurePort == getInsecurePortDefaultValue()) { LOG.info("Server uses standard insecure port {}", insecurePort); } else if (insecurePort == getPortDefaultValue()) { LOG.warn("Server found insecure port number configured to standard port for secure connections {}", getConfig().getInsecurePort()); LOG.warn("Possibly misconfigured?"); } return insecurePort; }
if (getConfig().getKeyCertOptions() == null) { if (getConfig().getPort() >= 0) { LOG.warn("Secure port number configured, but the certificate setup is not correct. No secure port will be opened - please check your configuration!"); if (!getConfig().isInsecurePortEnabled()) { LOG.error("configuration must have at least one of key & certificate or insecure port set to start up"); result.fail("no ports configured"); result.complete(); } else if (getConfig().isInsecurePortEnabled()) { if (getConfig().getPort(getPortDefaultValue()) == getConfig().getInsecurePort(getInsecurePortDefaultValue())) { LOG.error("secure and insecure ports must be configured to bind to different port numbers"); result.fail("secure and insecure ports configured to bind to same port number");
if (getConfig().getKeyCertOptions() == null) { if (getConfig().getPort() >= 0) { LOG.warn("Secure port number configured, but the certificate setup is not correct. No secure port will be opened - please check your configuration!"); if (!getConfig().isInsecurePortEnabled()) { LOG.error("configuration must have at least one of key & certificate or insecure port set to start up"); result.fail("no ports configured"); result.complete(); } else if (getConfig().isInsecurePortEnabled()) { if (getConfig().getPort(getPortDefaultValue()) == getConfig().getInsecurePort(getInsecurePortDefaultValue())) { LOG.error("secure and insecure ports must be configured to bind to different port numbers"); result.fail("secure and insecure ports configured to bind to same port number");
/** * Gets the insecure port number that this service has bound to. * <p> * The port number is determined as follows: * <ol> * <li>if this service is already listening on an insecure port, the corresponding socket's actual port number is returned, else</li> * <li>if this service has been configured to listen on an insecure port, the configured port number is returned, else</li> * <li>{@link Constants#PORT_UNCONFIGURED} is returned.</li> * </ol> * * @return The port number. */ public final int getInsecurePort() { if (getActualInsecurePort() != Constants.PORT_UNCONFIGURED) { return getActualInsecurePort(); } else if (isInsecurePortEnabled()) { return getConfig().getInsecurePort(getInsecurePortDefaultValue()); } else { return Constants.PORT_UNCONFIGURED; } }
/** * Gets the secure port number that this service has bound to. * <p> * The port number is determined as follows: * <ol> * <li>if this service is already listening on a secure port, the corresponding socket's actual port number is returned, else</li> * <li>if this service has been configured to listen on a secure port, the configured port number is returned, else</li> * <li>{@link Constants#PORT_UNCONFIGURED} is returned.</li> * </ol> * * @return The port number. */ public final int getPort() { if (getActualPort() != Constants.PORT_UNCONFIGURED) { return getActualPort(); } else if (isSecurePortEnabled()) { return getConfig().getPort(getPortDefaultValue()); } else { return Constants.PORT_UNCONFIGURED; } };
/** * Gets the secure port number that this service has bound to. * <p> * The port number is determined as follows: * <ol> * <li>if this service is already listening on a secure port, the corresponding socket's actual port number is returned, else</li> * <li>if this service has been configured to listen on a secure port, the configured port number is returned, else</li> * <li>{@link Constants#PORT_UNCONFIGURED} is returned.</li> * </ol> * * @return The port number. */ public final int getPort() { if (getActualPort() != Constants.PORT_UNCONFIGURED) { return getActualPort(); } else if (isSecurePortEnabled()) { return getConfig().getPort(getPortDefaultValue()); } else { return Constants.PORT_UNCONFIGURED; } };
/** * Gets the insecure port number that this service has bound to. * <p> * The port number is determined as follows: * <ol> * <li>if this service is already listening on an insecure port, the corresponding socket's actual port number is returned, else</li> * <li>if this service has been configured to listen on an insecure port, the configured port number is returned, else</li> * <li>{@link Constants#PORT_UNCONFIGURED} is returned.</li> * </ol> * * @return The port number. */ public final int getInsecurePort() { if (getActualInsecurePort() != Constants.PORT_UNCONFIGURED) { return getActualInsecurePort(); } else if (isInsecurePortEnabled()) { return getConfig().getInsecurePort(getInsecurePortDefaultValue()); } else { return Constants.PORT_UNCONFIGURED; } }