Search in sources :

Example 1 with ProtectionParameter

use of org.wildfly.security.credential.store.CredentialStore.ProtectionParameter in project fuse-karaf by jboss-fuse.

the class CredentialStoreHelper method credentialStoreFromEnvironment.

/**
 * Creates the credential store specified by the configuration in environment variables.
 *
 * @return the credential store
 * @throws GeneralSecurityException
 * @throws IOException
 */
public static CredentialStore credentialStoreFromEnvironment() throws GeneralSecurityException, IOException {
    final String credentialStoreAlgorithm = Optional.ofNullable(getenv(CREDENTIAL_STORE_ALGORITHM_ENV)).orElse(Defaults.CREDENTIAL_STORE_ALGORITHM);
    final Provider provider = ProviderHelper.provider(Optional.ofNullable(getenv(CREDENTIAL_STORE_PROVIDER_ENV)).orElse(ProviderHelper.WILDFLY_PROVIDER));
    final CredentialStore credentialStore = CredentialStore.getInstance(credentialStoreAlgorithm, provider);
    final Map<String, String> attributes = defaultCredentialStoreAttributesFor(credentialStoreAlgorithm);
    attributes.putAll(attributesFromEnvironment(CREDENTIAL_STORE_ATTR_ENV_PREFIX));
    final ProtectionParameter protectionParameter = createProtectionParameterFromEnvironment();
    credentialStore.initialize(attributes, protectionParameter);
    return credentialStore;
}
Also used : CredentialStore(org.wildfly.security.credential.store.CredentialStore) KeyStoreCredentialStore(org.wildfly.security.credential.store.impl.KeyStoreCredentialStore) Provider(java.security.Provider) ProtectionParameter(org.wildfly.security.credential.store.CredentialStore.ProtectionParameter)

Aggregations

Provider (java.security.Provider)1 CredentialStore (org.wildfly.security.credential.store.CredentialStore)1 ProtectionParameter (org.wildfly.security.credential.store.CredentialStore.ProtectionParameter)1 KeyStoreCredentialStore (org.wildfly.security.credential.store.impl.KeyStoreCredentialStore)1