for (Account account : listOfAccounts) { for (User user : account.getUsers()) { if (user.getName().equals(username) && user.getDomain().equals(domain)) { return ApiKeyPair.builder().apiKey(user.getApiKey()) .secretKey(user.getSecretKey()).build();
for (Account account : listOfAccounts) { for (User user : account.getUsers()) { if (user.getName().equals(username) && user.getDomain().equals(domain)) { return ApiKeyPair.builder().apiKey(user.getApiKey()) .secretKey(user.getSecretKey()).build();
for (Account account : listOfAccounts) { for (User user : account.getUsers()) { if (user.getName().equals(username) && user.getDomain().equals(domain)) { return ApiKeyPair.builder().apiKey(user.getApiKey()) .secretKey(user.getSecretKey()).build();
@Override public boolean apply(Network network) { return network.isDefault() && !network.isSecurityGroupEnabled() && !network.isSystem() && network.getAccount().equals(user.getName()); } }));
@Override public boolean apply(Network network) { return network.isDefault() && !network.isSecurityGroupEnabled() && !network.isSystem() && network.getAccount().equals(user.getName()); } }));
@Test public void testCreateUser() { skipIfNotGlobalAdmin(); Account testAccount = createTestAccount(globalAdminClient, prefix); User testUser = null; try { testUser = createTestUser(globalAdminClient, testAccount, prefix); assertNotNull(testUser); assertEquals(testUser.getName(), prefix + "-user"); assertEquals(testUser.getAccount(), prefix + "-account"); User updatedUser = globalAdminClient.getUserClient() .updateUser(testUser.getId(), userName(prefix + "-user-2")); assertNotNull(updatedUser); assertEquals(updatedUser.getName(), prefix + "-user-2"); ApiKeyPair apiKeys = globalAdminClient.getUserClient() .registerUserKeys(updatedUser.getId()); assertNotNull(apiKeys.getApiKey()); assertNotNull(apiKeys.getSecretKey()); checkAuthAsUser(apiKeys); } finally { if (testUser != null) { globalAdminClient.getUserClient().deleteUser(testUser.getId()); } globalAdminClient.getAccountClient().deleteAccount(testAccount.getId()); } }
@Test public void testCreateUser() { skipIfNotGlobalAdmin(); Account testAccount = createTestAccount(globalAdminClient, prefix); User testUser = null; try { testUser = createTestUser(globalAdminClient, testAccount, prefix); assertNotNull(testUser); assertEquals(testUser.getName(), prefix + "-user"); assertEquals(testUser.getAccount(), prefix + "-account"); User updatedUser = globalAdminClient.getUserClient() .updateUser(testUser.getId(), userName(prefix + "-user-2")); assertNotNull(updatedUser); assertEquals(updatedUser.getName(), prefix + "-user-2"); ApiKeyPair apiKeys = globalAdminClient.getUserClient() .registerUserKeys(updatedUser.getId()); assertNotNull(apiKeys.getApiKey()); assertNotNull(apiKeys.getSecretKey()); checkAuthAsUser(apiKeys); } finally { if (testUser != null) { globalAdminClient.getUserClient().deleteUser(testUser.getId()); } globalAdminClient.getAccountApi().deleteAccount(testAccount.getId()); } }
@Test public void testCreateContextUsingUserAndPasswordAuthentication() { skipIfNotGlobalAdmin(); Account testAccount = null; User testUser = null; String prefix = this.prefix + "-session"; try { testAccount = createTestAccount(globalAdminClient, prefix); testUser = createTestUser(globalAdminClient, testAccount, prefix); String expectedUsername = prefix + "-user"; assertEquals(testUser.getName(), expectedUsername); checkLoginAsTheNewUser(expectedUsername); ApiKeyPair expected = globalAdminClient.getUserClient().registerUserKeys(testUser.getId()); ApiKeyPair actual = ApiKeyPairs.loginToEndpointAsUsernameInDomainWithPasswordAndReturnApiKeyPair( URI.create(endpoint), prefix + "-user", "password", ""); assertEquals(actual, expected); } finally { if (testUser != null) globalAdminClient.getUserClient().deleteUser(testUser.getId()); if (testAccount != null) globalAdminClient.getAccountClient().deleteAccount(testAccount.getId()); } }
@Test public void testCreateContextUsingUserAndPasswordAuthentication() { skipIfNotGlobalAdmin(); Account testAccount = null; User testUser = null; String prefix = this.prefix + "-session"; try { testAccount = createTestAccount(globalAdminClient, prefix); testUser = createTestUser(globalAdminClient, testAccount, prefix); String expectedUsername = prefix + "-user"; assertEquals(testUser.getName(), expectedUsername); checkLoginAsTheNewUser(expectedUsername); ApiKeyPair expected = globalAdminClient.getUserClient().registerUserKeys(testUser.getId()); ApiKeyPair actual = ApiKeyPairs.loginToEndpointAsUsernameInDomainWithPasswordAndReturnApiKeyPair( URI.create(endpoint), prefix + "-user", "password", ""); assertEquals(actual, expected); } finally { if (testUser != null) globalAdminClient.getUserClient().deleteUser(testUser.getId()); if (testAccount != null) globalAdminClient.getAccountApi().deleteAccount(testAccount.getId()); } }
public T fromUser(User in) { return this .id(in.getId()) .name(in.getName()) .firstName(in.getFirstName()) .lastName(in.getLastName()) .email(in.getEmail()) .created(in.getCreated()) .state(in.getState()) .account(in.getAccount()) .accountType(in.getAccountType()) .domain(in.getDomain()) .domainId(in.getDomainId()) .timeZone(in.getTimeZone()) .apiKey(in.getApiKey()) .secretKey(in.getSecretKey()); } }
public T fromUser(User in) { return this .id(in.getId()) .name(in.getName()) .firstName(in.getFirstName()) .lastName(in.getLastName()) .email(in.getEmail()) .created(in.getCreated()) .state(in.getState()) .account(in.getAccount()) .accountType(in.getAccountType()) .domain(in.getDomain()) .domainId(in.getDomainId()) .timeZone(in.getTimeZone()) .apiKey(in.getApiKey()) .secretKey(in.getSecretKey()); } }
public T fromUser(User in) { return this .id(in.getId()) .name(in.getName()) .firstName(in.getFirstName()) .lastName(in.getLastName()) .email(in.getEmail()) .created(in.getCreated()) .state(in.getState()) .account(in.getAccount()) .accountType(in.getAccountType()) .domain(in.getDomain()) .domainId(in.getDomainId()) .timeZone(in.getTimeZone()) .apiKey(in.getApiKey()) .secretKey(in.getSecretKey()); } }
assert account.getUsers() != null : account; for (User user : account.getUsers()) { assert user.getName() != null : user; assert user.getAccountType().equals(account.getType()) : user; assert user.getDomain().equals(account.getDomain()) : user;
assert account.getUsers() != null : account; for (User user : account.getUsers()) { assert user.getName() != null : user; assert user.getAccountType().equals(account.getType()) : user; assert user.getDomain().equals(account.getDomain()) : user;