@Override public CredentialProviderToken clone() { CredentialProviderToken clone = (CredentialProviderToken) super.clone(); clone.setPassword(this.getPassword()); return clone; }
public CredentialProviderToken(String name, String credentialProviders) throws IOException { requireNonNull(name); requireNonNull(credentialProviders); setWithCredentialProviders(name, credentialProviders); }
protected void setWithCredentialProviders(String name, String credentialProviders) throws IOException { this.name = name; this.credentialProviders = credentialProviders; final Configuration conf = new Configuration(); conf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, credentialProviders); char[] password = CredentialProviderFactoryShim.getValueFromCredentialProvider(conf, name); if (password == null) { throw new IOException( "No password could be extracted from CredentialProvider(s) with " + name); } setPassword(CharBuffer.wrap(password)); }
protected void setWithCredentialProviders(String name, String credentialProviders) throws IOException { final Configuration conf = new Configuration(CachedConfiguration.getInstance()); conf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, credentialProviders); char[] password = CredentialProviderFactoryShim.getValueFromCredentialProvider(conf, name); if (null == password) { throw new IOException( "No password could be extracted from CredentialProvider(s) with " + name); } setPassword(CharBuffer.wrap(password)); }
@Override public CredentialProviderToken clone() { CredentialProviderToken clone = (CredentialProviderToken) super.clone(); clone.setPassword(this.getPassword()); return clone; }
@Override public void init(Properties properties) { char[] nameCharArray = properties.get(NAME_PROPERTY), credentialProvidersCharArray = properties.get(CREDENTIAL_PROVIDERS_PROPERTY); if (nameCharArray != null && credentialProvidersCharArray != null) { try { this.setWithCredentialProviders(new String(nameCharArray), new String(credentialProvidersCharArray)); } catch (IOException e) { throw new IllegalArgumentException("Could not extract password from CredentialProvider", e); } return; } throw new IllegalArgumentException( "Expected " + NAME_PROPERTY + " and " + CREDENTIAL_PROVIDERS_PROPERTY + " properties."); }
public CredentialProviderToken(String name, String credentialProviders) throws IOException { requireNonNull(name); requireNonNull(credentialProviders); setWithCredentialProviders(name, credentialProviders); }
@Override public void init(Properties properties) { char[] nameCharArray = properties.get(NAME_PROPERTY), credentialProvidersCharArray = properties.get(CREDENTIAL_PROVIDERS_PROPERTY); if (null != nameCharArray && null != credentialProvidersCharArray) { try { this.setWithCredentialProviders(new String(nameCharArray), new String(credentialProvidersCharArray)); } catch (IOException e) { throw new IllegalArgumentException("Could not extract password from CredentialProvider", e); } return; } throw new IllegalArgumentException( "Expected " + NAME_PROPERTY + " and " + CREDENTIAL_PROVIDERS_PROPERTY + " properties."); }