public void addUpdate(UserCredential userCredential) { configManager.updateXML( USER_CREDENTIALS_CONFIG, newAddUpdateUserCredentialsDocumentAlteration(userCredential)); if (userCredential.getServiceKey() != null) { usersWithServiceKey.add(userCredential.getUsername()); } }
public String getUserCredentialByServiceKey(String serviceKey) { for (String usernameWithServiceKey : usersWithServiceKey) { UserCredential userCredential = getUserCredential(usernameWithServiceKey); if (userCredential != null && serviceKey.equals(userCredential.getServiceKey())) { return userCredential.getUsername(); } } return null; }