throw log.invalidProtectionParameter(protectionParameter); final CredentialSource credentialSource = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource(); final SecretKey secretKey; try {
throw log.invalidProtectionParameter(protectionParameter); final CredentialSource credentialSource = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource(); final SecretKey secretKey; try {
throw log.invalidProtectionParameter(protectionParameter); final CredentialSource credentialSource = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource(); final SecretKey secretKey; try {
throw log.invalidProtectionParameter(protectionParameter); final CredentialSource credentialSource = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource(); final SecretKey secretKey; try {
/** * 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 KeyStore.ProtectionParameter convertParameter(final CredentialStore.ProtectionParameter protectionParameter) throws CredentialStoreException { // only one conversion is really possible. if (protectionParameter == null) { return convertParameter(this.protectionParameter); } else if (protectionParameter instanceof CredentialStore.CredentialSourceProtectionParameter) { final CredentialSource credentialSource = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource(); try { return credentialSource.applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, p -> new KeyStore.PasswordProtection(p.getPassword()))); } catch (IOException e) { throw log.cannotAcquireCredentialFromStore(e); } } else { throw log.invalidProtectionParameter(protectionParameter); } }
private KeyStore.ProtectionParameter convertParameter(final CredentialStore.ProtectionParameter protectionParameter) throws CredentialStoreException { // only one conversion is really possible. if (protectionParameter == null) { return convertParameter(this.protectionParameter); } else if (protectionParameter instanceof CredentialStore.CredentialSourceProtectionParameter) { final CredentialSource credentialSource = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource(); try { return credentialSource.applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, p -> new KeyStore.PasswordProtection(p.getPassword()))); } catch (IOException e) { throw log.cannotAcquireCredentialFromStore(e); } } else { throw log.invalidProtectionParameter(protectionParameter); } }
private CredentialStore.CredentialSourceProtectionParameter credentialToCredentialSourceProtectionParameter(Credential credential) { return new CredentialStore.CredentialSourceProtectionParameter(IdentityCredentials.NONE.withCredential(credential)); }
private KeyStore.ProtectionParameter convertParameter(final CredentialStore.ProtectionParameter protectionParameter) throws CredentialStoreException { // only one conversion is really possible. if (protectionParameter == null) { return convertParameter(this.protectionParameter); } else if (protectionParameter instanceof CredentialStore.CredentialSourceProtectionParameter) { final CredentialSource credentialSource = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource(); try { return credentialSource.applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, p -> new KeyStore.PasswordProtection(p.getPassword()))); } catch (IOException e) { throw log.cannotAcquireCredentialFromStore(e); } } else { throw log.invalidProtectionParameter(protectionParameter); } }
private static char[] getStorePassword(final CredentialStore.ProtectionParameter protectionParameter) throws IOException, CredentialStoreException { final char[] password; if (protectionParameter instanceof CredentialStore.CredentialSourceProtectionParameter) { password = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource().applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, ClearPassword::getPassword)); } else if (protectionParameter != null) { throw log.invalidProtectionParameter(protectionParameter); } else { password = null; } return password; }
private static char[] getStorePassword(final CredentialStore.ProtectionParameter protectionParameter) throws IOException, CredentialStoreException { final char[] password; if (protectionParameter instanceof CredentialStore.CredentialSourceProtectionParameter) { password = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource().applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, ClearPassword::getPassword)); } else if (protectionParameter != null) { throw log.invalidProtectionParameter(protectionParameter); } else { password = null; } return password; }
private static char[] getStorePassword(final CredentialStore.ProtectionParameter protectionParameter) throws IOException, CredentialStoreException { final char[] password; if (protectionParameter instanceof CredentialStore.CredentialSourceProtectionParameter) { password = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource().applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, ClearPassword::getPassword)); } else if (protectionParameter != null) { throw log.invalidProtectionParameter(protectionParameter); } else { password = null; } return password; }
/** * 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 KeyStore.ProtectionParameter convertParameter(final CredentialStore.ProtectionParameter protectionParameter) throws CredentialStoreException { // only one conversion is really possible. if (protectionParameter == null) { return convertParameter(this.protectionParameter); } else if (protectionParameter instanceof CredentialStore.CredentialSourceProtectionParameter) { final CredentialSource credentialSource = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource(); try { return credentialSource.applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, p -> new KeyStore.PasswordProtection(p.getPassword()))); } catch (IOException e) { throw log.cannotAcquireCredentialFromStore(e); } } else { throw log.invalidProtectionParameter(protectionParameter); } }
private static char[] getStorePassword(final CredentialStore.ProtectionParameter protectionParameter) throws IOException, CredentialStoreException { final char[] password; if (protectionParameter instanceof CredentialStore.CredentialSourceProtectionParameter) { password = ((CredentialStore.CredentialSourceProtectionParameter) protectionParameter).getCredentialSource().applyToCredential(PasswordCredential.class, c -> c.getPassword().castAndApply(ClearPassword.class, ClearPassword::getPassword)); } else if (protectionParameter != null) { throw log.invalidProtectionParameter(protectionParameter); } else { password = null; } return password; }