/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static CredentialStore getInstance(String algorithm) throws NoSuchAlgorithmException { return getInstance(algorithm, INSTALLED_PROVIDERS); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providerName the name of the provider to use * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations * @throws NoSuchProviderException if given provider name cannot match any registered {@link Provider} */ public static CredentialStore getInstance(String algorithm, String providerName) throws NoSuchAlgorithmException, NoSuchProviderException { final Provider provider = Security.getProvider(providerName); if (provider == null) throw new NoSuchProviderException(providerName); return getInstance(algorithm, provider); }
/** * Create an instance of {@link CredentialStore} and initialize it. * * @return the new instance * @throws GeneralSecurityException if instantiation fails for some reason */ @Override public CredentialStore get() throws ConfigXMLParseException { final CredentialStore credentialStore; try { if (providers != null) { credentialStore = providerName != null ? CredentialStore.getInstance(type, providerName, providers) : CredentialStore.getInstance(type, providers); } else { credentialStore = providerName != null ? CredentialStore.getInstance(type, providerName) : CredentialStore.getInstance(type); } credentialStore.initialize(attributes, credentialSource == null ? null : new CredentialStore.CredentialSourceProtectionParameter(credentialSource.get())); } catch (GeneralSecurityException e) { throw xmlLog.xmlFailedToCreateCredentialStore(location, e); } return credentialStore; }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providerName the name of the provider to use * @param providers supplier of provider instances to search * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations * @throws NoSuchProviderException if given provider name cannot match any registered {@link Provider} */ public static CredentialStore getInstance(String algorithm, String providerName, Supplier<Provider[]> providers) throws NoSuchAlgorithmException, NoSuchProviderException { checkNotNullParam("algorithm", algorithm); checkNotNullParam("providerName", providerName); checkNotNullParam("providers", providers); Provider provider = null; for (Provider current : providers.get()) { if (providerName.equals(current.getName())) { provider = current; break; } } if (provider == null) throw new NoSuchProviderException(providerName); return getInstance(algorithm, provider); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static CredentialStore getInstance(String algorithm) throws NoSuchAlgorithmException { return getInstance(algorithm, INSTALLED_PROVIDERS); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static CredentialStore getInstance(String algorithm) throws NoSuchAlgorithmException { return getInstance(algorithm, INSTALLED_PROVIDERS); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations */ public static CredentialStore getInstance(String algorithm) throws NoSuchAlgorithmException { return getInstance(algorithm, INSTALLED_PROVIDERS); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providerName the name of the provider to use * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations * @throws NoSuchProviderException if given provider name cannot match any registered {@link Provider} */ public static CredentialStore getInstance(String algorithm, String providerName) throws NoSuchAlgorithmException, NoSuchProviderException { final Provider provider = Security.getProvider(providerName); if (provider == null) throw new NoSuchProviderException(providerName); return getInstance(algorithm, provider); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providerName the name of the provider to use * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations * @throws NoSuchProviderException if given provider name cannot match any registered {@link Provider} */ public static CredentialStore getInstance(String algorithm, String providerName) throws NoSuchAlgorithmException, NoSuchProviderException { final Provider provider = Security.getProvider(providerName); if (provider == null) throw new NoSuchProviderException(providerName); return getInstance(algorithm, provider); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providerName the name of the provider to use * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations * @throws NoSuchProviderException if given provider name cannot match any registered {@link Provider} */ public static CredentialStore getInstance(String algorithm, String providerName) throws NoSuchAlgorithmException, NoSuchProviderException { final Provider provider = Security.getProvider(providerName); if (provider == null) throw new NoSuchProviderException(providerName); return getInstance(algorithm, provider); }
/** * Create an instance of {@link CredentialStore} and initialize it. * * @return the new instance * @throws GeneralSecurityException if instantiation fails for some reason */ @Override public CredentialStore get() throws ConfigXMLParseException { final CredentialStore credentialStore; try { if (providers != null) { credentialStore = providerName != null ? CredentialStore.getInstance(type, providerName, providers) : CredentialStore.getInstance(type, providers); } else { credentialStore = providerName != null ? CredentialStore.getInstance(type, providerName) : CredentialStore.getInstance(type); } credentialStore.initialize(attributes, credentialSource == null ? null : new CredentialStore.CredentialSourceProtectionParameter(credentialSource.get())); } catch (GeneralSecurityException e) { throw xmlLog.xmlFailedToCreateCredentialStore(location, e); } return credentialStore; }
/** * Create an instance of {@link CredentialStore} and initialize it. * * @return the new instance * @throws GeneralSecurityException if instantiation fails for some reason */ @Override public CredentialStore get() throws ConfigXMLParseException { final CredentialStore credentialStore; try { if (providers != null) { credentialStore = providerName != null ? CredentialStore.getInstance(type, providerName, providers) : CredentialStore.getInstance(type, providers); } else { credentialStore = providerName != null ? CredentialStore.getInstance(type, providerName) : CredentialStore.getInstance(type); } credentialStore.initialize(attributes, credentialSource == null ? null : new CredentialStore.CredentialSourceProtectionParameter(credentialSource.get())); } catch (GeneralSecurityException e) { throw xmlLog.xmlFailedToCreateCredentialStore(location, e); } return credentialStore; }
/** * Create an instance of {@link CredentialStore} and initialize it. * * @return the new instance * @throws GeneralSecurityException if instantiation fails for some reason */ @Override public CredentialStore get() throws ConfigXMLParseException { final CredentialStore credentialStore; try { if (providers != null) { credentialStore = providerName != null ? CredentialStore.getInstance(type, providerName, providers) : CredentialStore.getInstance(type, providers); } else { credentialStore = providerName != null ? CredentialStore.getInstance(type, providerName) : CredentialStore.getInstance(type); } credentialStore.initialize(attributes, credentialSource == null ? null : new CredentialStore.CredentialSourceProtectionParameter(credentialSource.get())); } catch (GeneralSecurityException e) { throw xmlLog.xmlFailedToCreateCredentialStore(location, e); } return credentialStore; }
private CredentialStore getCredentialStoreInstance() throws CredentialStoreException, NoSuchAlgorithmException, NoSuchProviderException { if (provider != null) { // directly specified provider return CredentialStore.getInstance(type, provider); } Provider[] injectedProviders = providers.getOptionalValue(); if (ROOT_LOGGER.isTraceEnabled()) { ROOT_LOGGER.tracef("obtaining CredentialStore %s from providers %s", name, Arrays.toString(injectedProviders)); } if (injectedProviders != null) { // injected provider list, select the first provider with corresponding type for (Provider p : injectedProviders) { try { return CredentialStore.getInstance(type, p); } catch (NoSuchAlgorithmException ignore) { } } throw ROOT_LOGGER.providerLoaderCannotSupplyProvider(providerLoaderName, type); } else { // default provider return CredentialStore.getInstance(type); } }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providerName the name of the provider to use * @param providers supplier of provider instances to search * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations * @throws NoSuchProviderException if given provider name cannot match any registered {@link Provider} */ public static CredentialStore getInstance(String algorithm, String providerName, Supplier<Provider[]> providers) throws NoSuchAlgorithmException, NoSuchProviderException { checkNotNullParam("algorithm", algorithm); checkNotNullParam("providerName", providerName); checkNotNullParam("providers", providers); Provider provider = null; for (Provider current : providers.get()) { if (providerName.equals(current.getName())) { provider = current; break; } } if (provider == null) throw new NoSuchProviderException(providerName); return getInstance(algorithm, provider); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providerName the name of the provider to use * @param providers supplier of provider instances to search * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations * @throws NoSuchProviderException if given provider name cannot match any registered {@link Provider} */ public static CredentialStore getInstance(String algorithm, String providerName, Supplier<Provider[]> providers) throws NoSuchAlgorithmException, NoSuchProviderException { checkNotNullParam("algorithm", algorithm); checkNotNullParam("providerName", providerName); checkNotNullParam("providers", providers); Provider provider = null; for (Provider current : providers.get()) { if (providerName.equals(current.getName())) { provider = current; break; } } if (provider == null) throw new NoSuchProviderException(providerName); return getInstance(algorithm, provider); }
/** * Get a {@code CredentialStore} instance. The returned CredentialStore object will implement the given algorithm. * * @param algorithm the name of the algorithm * @param providerName the name of the provider to use * @param providers supplier of provider instances to search * @return a {@code CredentialStore} instance * @throws NoSuchAlgorithmException if the given algorithm has no available implementations * @throws NoSuchProviderException if given provider name cannot match any registered {@link Provider} */ public static CredentialStore getInstance(String algorithm, String providerName, Supplier<Provider[]> providers) throws NoSuchAlgorithmException, NoSuchProviderException { checkNotNullParam("algorithm", algorithm); checkNotNullParam("providerName", providerName); checkNotNullParam("providers", providers); Provider provider = null; for (Provider current : providers.get()) { if (providerName.equals(current.getName())) { provider = current; break; } } if (provider == null) throw new NoSuchProviderException(providerName); return getInstance(algorithm, provider); }