Class Utils
java.lang.Object
uk.ac.manchester.spinnaker.alloc.security.Utils
Support utility methods for working with SSL stuff.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidSet up the default SSL context so that we can inject our trust store for verifying servers.static KeyStoreLoads a trust store.static X509TrustManagertrustManager(KeyStore truststore) Load a trust store into a trust manager.
-
Method Details
-
trustManager
Load a trust store into a trust manager.- Parameters:
truststore- The trust store to load, ornullto use the default.- Returns:
- The configured trust manager.
- Throws:
GeneralSecurityException- If things go wrong.- See Also:
-
installInjectableTrustStoreAsDefault
public static void installInjectableTrustStoreAsDefault(Supplier<X509TrustManager> injector) throws GeneralSecurityException Set up the default SSL context so that we can inject our trust store for verifying servers.- Parameters:
injector- How to get the value to inject.- Throws:
GeneralSecurityException- If the SSL context can't be built.- See Also:
-
loadTrustStore
public static KeyStore loadTrustStore(SpallocProperties.OpenIDProperties props) throws GeneralSecurityException, IOException Loads a trust store.- Parameters:
props- Where is the trust store and how should we load it?- Returns:
- The trust store. Note that this is not installed into anything.
- Throws:
GeneralSecurityException- If the trust store contains bad info.IOException- If the trust store can't be read at all.
-