Class SpiffeTrustManagerFactory
java.lang.Object
javax.net.ssl.TrustManagerFactorySpi
io.spiffe.provider.SpiffeTrustManagerFactory
Implementation of a
TrustManagerFactory to create a SpiffeTrustManager backed by a
DefaultX509Source that is maintained via the Workload API.
The Java Security API will call engineGetTrustManagers() to get an instance of a TrustManager.
This TrustManager instance gets injected an DefaultX509Source, which implements BundleSource and
keeps bundles updated.
The TrustManager also gets a Supplier of a Set of accepted SPIFFE IDs used to validate the SPIFFE ID from the SVIDs
presented by a peer during the secure socket handshake.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates aTrustManagerinitialized with theDefaultX509Sourceinstance that is handled by theX509SourceManager, and with and a supplier of accepted SPIFFE IDs.engineGetTrustManagers(@NonNull io.spiffe.bundle.BundleSource<io.spiffe.bundle.x509bundle.X509Bundle> x509BundleSource) Creates aTrustManagerinitialized with theBundleSourceto provide X.509 bundles, and with and a supplier of accepted SPIFFE IDs.engineGetTrustManagers(@NonNull io.spiffe.bundle.BundleSource<io.spiffe.bundle.x509bundle.X509Bundle> x509BundleSource, @NonNull Supplier<Set<io.spiffe.spiffeid.SpiffeId>> acceptedSpiffeIdsSupplier) Creates a TrustManager initialized with aBundleSourceto provide X.509 bundles, and a supplier of accepted SPIFFE IDs.engineGetTrustManagersAcceptAnySpiffeId(@NonNull io.spiffe.bundle.BundleSource<io.spiffe.bundle.x509bundle.X509Bundle> x509BundleSource) Creates aTrustManagerinitialized with aBundleSourceto provide the X.509 bundles.protected voidengineInit(KeyStore keyStore) protected voidengineInit(ManagerFactoryParameters managerFactoryParameters)
-
Constructor Details
-
SpiffeTrustManagerFactory
public SpiffeTrustManagerFactory()
-
-
Method Details
-
engineGetTrustManagers
Creates aTrustManagerinitialized with theDefaultX509Sourceinstance that is handled by theX509SourceManager, and with and a supplier of accepted SPIFFE IDs. that reads the Set ofSpiffeIdfrom the System Property 'ssl.spiffe.accept'.If the System property 'ssl.spiffe.acceptAll' is defined as 'true', the TrustManager is configure to accept any SPIFFE ID presented by a peer.
- Specified by:
engineGetTrustManagersin classTrustManagerFactorySpi- Returns:
- an instance of a
TrustManagerwrapped in an array. The actual type returned isSpiffeTrustManager - Throws:
SpiffeProviderException- in case there is an error setting up the X.509 source
-
engineGetTrustManagers
public TrustManager[] engineGetTrustManagers(@NonNull @NonNull io.spiffe.bundle.BundleSource<io.spiffe.bundle.x509bundle.X509Bundle> x509BundleSource) Creates aTrustManagerinitialized with theBundleSourceto provide X.509 bundles, and with and a supplier of accepted SPIFFE IDs. that reads the set from the System Property 'ssl.spiffe.accept'.If the System property 'ssl.spiffe.acceptAll' is defined as 'true', the TrustManager is configure to accept any SPIFFE ID presented by a peer.
- Parameters:
x509BundleSource- a source of X.509 bundles- Returns:
- an instance of a
TrustManagerwrapped in an array. The actual type returned isSpiffeTrustManager
-
engineGetTrustManagersAcceptAnySpiffeId
public TrustManager[] engineGetTrustManagersAcceptAnySpiffeId(@NonNull @NonNull io.spiffe.bundle.BundleSource<io.spiffe.bundle.x509bundle.X509Bundle> x509BundleSource) Creates aTrustManagerinitialized with aBundleSourceto provide the X.509 bundles. The TrustManager is configured to accept any SPIFFE ID.- Parameters:
x509BundleSource- a source of X.509 bundles- Returns:
- an instance of a
TrustManagerwrapped in an array. The actual type returned isSpiffeTrustManager
-
engineGetTrustManagers
public TrustManager[] engineGetTrustManagers(@NonNull @NonNull io.spiffe.bundle.BundleSource<io.spiffe.bundle.x509bundle.X509Bundle> x509BundleSource, @NonNull @NonNull Supplier<Set<io.spiffe.spiffeid.SpiffeId>> acceptedSpiffeIdsSupplier) Creates a TrustManager initialized with aBundleSourceto provide X.509 bundles, and a supplier of accepted SPIFFE IDs.- Parameters:
x509BundleSource- aBundleSourceto provide the X.509-BundlesacceptedSpiffeIdsSupplier- a Supplier to provide a set of SPIFFE IDs that are accepted- Returns:
- an instance of a
TrustManagerwrapped in an array. The actual type returned isSpiffeTrustManager
-
engineInit
- Specified by:
engineInitin classTrustManagerFactorySpi
-
engineInit
- Specified by:
engineInitin classTrustManagerFactorySpi
-