Class PkiCredentialFactory
java.lang.Object
se.swedenconnect.security.credential.factory.PkiCredentialFactory
Factory class for creating
PkiCredential
instances.- Author:
- Martin Lindström
-
Method Summary
Modifier and TypeMethodDescriptionstatic PkiCredential
createCredential
(PemCredentialConfiguration configuration, ConfigurationResourceLoader resourceLoader) Creates aPkiCredential
based on aPemCredentialConfiguration
.static PkiCredential
createCredential
(PkiCredentialConfiguration configuration, ConfigurationResourceLoader resourceLoader, Function<String, PkiCredential> credentialProvider, Function<String, KeyStore> keyStoreProvider, Function<String, KeyStoreReloader> keyStoreReloaderProvider) Creates aPkiCredential
based on the suppliedPkiCredentialConfiguration
.static PkiCredential
createCredential
(StoreCredentialConfiguration configuration, ConfigurationResourceLoader resourceLoader, Function<String, KeyStore> keyStoreProvider, Function<String, KeyStoreReloader> keyStoreReloaderProvider) Creates aPkiCredential
based on aStoreCredentialConfiguration
.
-
Method Details
-
createCredential
@Nonnull public static PkiCredential createCredential(@Nonnull PkiCredentialConfiguration configuration, @Nullable ConfigurationResourceLoader resourceLoader, @Nullable Function<String, PkiCredential> credentialProvider, @Nullable Function<String, throws IllegalArgumentException, IOException, NoSuchCredentialException, NoSuchKeyStoreException, CertificateException, KeyException, KeyStoreException, NoSuchProviderExceptionKeyStore> keyStoreProvider, @Nullable Function<String, KeyStoreReloader> keyStoreReloaderProvider) Creates aPkiCredential
based on the suppliedPkiCredentialConfiguration
.- Parameters:
configuration
- the configurationresourceLoader
- loader for readning files, ifnull
, aDefaultConfigurationResourceLoader
will be usedcredentialProvider
- if the supplied configuration object contains a credential bundle reference, this provider must be suppliedkeyStoreProvider
- if the supplied configuration object contains a key store reference, this provider must be suppliedkeyStoreReloaderProvider
- if store references are used, and those key stores are "reloadable", a function that resolves references to aKeyStoreReloader
may be supplied. If not, credentials will not be reloadable- Returns:
- a
PkiCredential
- Throws:
IllegalArgumentException
- for invalid configuration settingsIOException
- if a referenced file can not be readNoSuchCredentialException
- if a bundle is used in the supplied configuration, and it does not existNoSuchKeyStoreException
- if a reference to a key store can not be foundCertificateException
- for certificate decoding errorsKeyException
- for key decoding errorsKeyStoreException
- for errors unlocking the key storeNoSuchProviderException
- if a referenced provider does not exist
-
createCredential
@Nonnull public static PkiCredential createCredential(@Nonnull PemCredentialConfiguration configuration, @Nullable ConfigurationResourceLoader resourceLoader) throws IllegalArgumentException, IOException, CertificateException, KeyException Creates aPkiCredential
based on aPemCredentialConfiguration
.- Parameters:
configuration
- the configurationresourceLoader
- loader for readning files, ifnull
, aDefaultConfigurationResourceLoader
will be used- Returns:
- a
PkiCredential
- Throws:
IllegalArgumentException
- for invalid configuration settingsIOException
- if a referenced file can not be readCertificateException
- for certificate decoding errorsKeyException
- for key decoding errors
-
createCredential
@Nonnull public static PkiCredential createCredential(@Nonnull StoreCredentialConfiguration configuration, @Nullable ConfigurationResourceLoader resourceLoader, @Nullable Function<String, KeyStore> keyStoreProvider, @Nullable Function<String, throws IllegalArgumentException, IOException, NoSuchKeyStoreException, KeyStoreException, NoSuchProviderException, CertificateExceptionKeyStoreReloader> keyStoreReloaderProvider) Creates aPkiCredential
based on aStoreCredentialConfiguration
.- Parameters:
configuration
- the configurationresourceLoader
- loader for readning files, ifnull
, aDefaultConfigurationResourceLoader
will be usedkeyStoreProvider
- if store references are used, a function that resolves references to key stores must be suppliedkeyStoreReloaderProvider
- if store references are used, and those key stores are "reloadable", a function that resolves references to aKeyStoreReloader
may be supplied. If not, it will be assumed that the key store may be reloaded using the key password (which then must be the same as the store password)- Returns:
- a
PkiCredential
- Throws:
IllegalArgumentException
- for invalid configuration settingsIOException
- if a referenced file can not be readNoSuchKeyStoreException
- if a reference to a key store can not be foundKeyStoreException
- for errors unlocking the key storeNoSuchProviderException
- if a referenced provider does not existCertificateException
- for certificate decoding errors
-