@Test public void testEqualityAfterInit() throws Exception { CredentialProviderToken token = new CredentialProviderToken("root.password", keystorePath); CredentialProviderToken uninitializedToken = new CredentialProviderToken(); Properties props = new Properties(); props.put(CredentialProviderToken.NAME_PROPERTY, "root.password"); props.put(CredentialProviderToken.CREDENTIAL_PROVIDERS_PROPERTY, keystorePath); uninitializedToken.init(props); assertArrayEquals(token.getPassword(), uninitializedToken.getPassword()); }
@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."); }
CredentialProviderToken extends PasswordToken { @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."); } }
CredentialProviderToken extends PasswordToken { @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."); } CredentialProviderToken();  CredentialProviderToken(String name, String credentialProviders); }
CredentialProviderToken extends PasswordToken { @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."); } CredentialProviderToken();  CredentialProviderToken(String name, String credentialProviders); String getName(); String getCredentialProviders(); @Override void init(Properties properties); @Override Set<TokenProperty> getProperties(); @Override CredentialProviderToken clone(); }
CredentialProviderToken extends PasswordToken { @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."); } CredentialProviderToken();  CredentialProviderToken(String name, String credentialProviders); String getName(); String getCredentialProviders(); @Override void init(Properties properties); @Override Set<TokenProperty> getProperties(); @Override CredentialProviderToken clone(); static final String NAME_PROPERTY; }