Class SecureEndpointsConfiguration

java.lang.Object
org.kiwiproject.config.SSLContextConfiguration
org.kiwiproject.config.SecureEndpointsConfiguration
All Implemented Interfaces:
KeyAndTrustStoreConfigProvider, TrustStoreConfigProvider

public class SecureEndpointsConfiguration extends SSLContextConfiguration
Configuration for secure REST endpoints, including the configuration from an SSLContextConfiguration as well as adding a collection of EndpointConfiguration instances. Supports programmatic creation using a builder. Also supports construction from external configuration, e.g. from a YAML configuration file, using the no-args constructor and setter methods.

As this is a configuration class that supports population from external configuration, it is mutable.

  • Constructor Details

    • SecureEndpointsConfiguration

      public SecureEndpointsConfiguration()
      Create instance with empty collection of endpoints.
  • Method Details

    • builder

      public static SecureEndpointsConfiguration.Builder builder()
      Return a new builder instance.
      Returns:
      the builder instance
    • isSecure

      public boolean isSecure()
      Returns true if any of the endpoints in this configuration is secure.

      Alias for anyEndpointSecure().

      Returns:
      true if any endpoint is secure
    • anyEndpointSecure

      public boolean anyEndpointSecure()
      Returns true if any of the endpoints in this configuration is secure.
      Returns:
      true if any of endpoint is secure: false otherwise
    • allEndpointsSecure

      public boolean allEndpointsSecure()
      Returns true if all of the endpoints in this configuration are secure.
      Returns:
      true if all endpoints are secure: false otherwise
    • getEndpointByTag

      public EndpointConfiguration getEndpointByTag(String tag)
      Finds the EndpointConfiguration with the given tag, throwing an exception if not found.
      Parameters:
      tag - the tag to search for
      Returns:
      the EndpointConfiguration with the given tag
      Throws:
      IllegalStateException - if there is no such endpoint
    • getEndpointByTagOrEmpty

      public Optional<EndpointConfiguration> getEndpointByTagOrEmpty(String tag)
      Finds the EndpointConfiguration with the given tag, returning an empty Optional if not found.
      Parameters:
      tag - the tag to search for
      Returns:
      an Optional that may or may not contain an endpoint
    • getEndpointByPathEnding

      public EndpointConfiguration getEndpointByPathEnding(String pathEnding)
      Finds the EndpointConfiguration with a path ending with the given pathEnding, throwing an exception if not found.
      Parameters:
      pathEnding - the end of the path to look for in each endpoint
      Returns:
      the EndpointConfiguration with the given path ending
      Throws:
      IllegalStateException - if there is no such endpoint
    • getEndpointByPathEndingOrEmpty

      public Optional<EndpointConfiguration> getEndpointByPathEndingOrEmpty(String pathEnding)
      Finds the EndpointConfiguration with a path ending with the given pathEnding, returning an empty Optional if not found.
      Parameters:
      pathEnding - the end of the path to look for in each endpoint
      Returns:
      an Optional that may or may not contain an endpoint
    • getEndpoints

      public List<EndpointConfiguration> getEndpoints()
      The endpoints in this configuration.
    • setEndpoints

      public void setEndpoints(List<EndpointConfiguration> endpoints)
      The endpoints in this configuration.