Class Address

java.lang.Object
io.spiffe.workloadapi.Address

public class Address extends Object
Parses and validates Workload API socket addresses following the SPIFFE standard and provides the default Workload API address.

See Also:
  • Field Details

    • SOCKET_ENV_VARIABLE

      public static final String SOCKET_ENV_VARIABLE
      Environment variable holding the default Workload API address.
      See Also:
  • Method Details

    • getDefaultAddress

      public static String getDefaultAddress()
      Returns the default Workload API address hold by the system environment variable.
      Returns:
      the default Workload API address hold by the system environment variable defined by SOCKET_ENV_VARIABLE.
      Throws:
      IllegalStateException - is the Environment variable is not set
    • parseAddress

      public static URI parseAddress(@NonNull @NonNull String address) throws SocketEndpointAddressException
      Parses and validates a Workload API socket address.

      The value of the address is structured as an RFC 3986 URI. The scheme MUST be set to either unix or tcp, which indicates that the endpoint is served over a Unix Domain Socket or a TCP listen socket, respectively.

      If the scheme is set to unix, then the authority component MUST NOT be set, and the path component MUST be set to the absolute path of the SPIFFE Workload Endpoint Unix Domain Socket (e.g. unix:///path/to/endpoint.sock). The scheme and path components are mandatory, and no other component may be set.

      If the scheme is set to tcp, then the host component of the authority MUST be set to an IP address, and the port component of the authority MUST be set to the TCP port number of the SPIFFE Workload Endpoint TCP listen socket. The scheme, host, and port components are mandatory, and no other component may be set. As an example, tcp://127.0.0.1:8000 is valid, and tcp://127.0.0.1:8000/foo is not.

      Parameters:
      address - the Workload API socket address as a string
      Returns:
      an instance of a URI
      Throws:
      SocketEndpointAddressException - if the address could not be parsed or if it doesn't complain to the rules defined in the SPIFFE Worload Endpoint Standard.
      See Also: