Class X509SourceManager

java.lang.Object
io.spiffe.provider.X509SourceManager

public final class X509SourceManager extends Object
Singleton that handles an instance of a DefaultX509Source that implements an X509Source.

The default SPIFFE socket endpoint address is used to create an X.509 Source backed by the Workload API.

If the environment variable is not defined, it will throw an IllegalStateException. If the X509Source cannot be initialized, it will throw a RuntimeException.

This Singleton needed to be able to handle a single DefaultX509Source instance to be used by the SpiffeKeyManagerFactory and SpiffeTrustManagerFactory to inject it in the SpiffeKeyManager and SpiffeTrustManager instances.

  • Method Details

    • getX509Source

      public static io.spiffe.workloadapi.X509Source getX509Source() throws io.spiffe.exception.X509SourceException, io.spiffe.exception.SocketEndpointAddressException
      Returns the single instance handled by this singleton. If the instance has not been created yet, it creates a new X509Source and initializes the singleton in a thread safe way.
      Returns:
      the single instance of DefaultX509Source
      Throws:
      io.spiffe.exception.X509SourceException - if the X.509 source could not be initialized
      io.spiffe.exception.SocketEndpointAddressException - is the socket endpoint address is not valid