Package org.jclouds.domain

Examples of org.jclouds.domain.LoginCredentials


            .description("us-east-1").build();

   @Test
   public void testApplyWhereTagDoesntMatchAndImageHardwareAndLocationNotFoundButCredentialsFound()
            throws UnknownHostException {
      LoginCredentials creds = LoginCredentials.builder().user("root").password("abdce").build();

      RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet.<Hardware> of(), ImmutableSet
               .<Location> of(), ImmutableSet.<Image> of(), ImmutableMap.<String, Credentials> of(
               "node#us-east-1/i-0799056f", creds));
View Full Code Here


   @Test
   public void testApply() throws Exception {
      WindowsLoginCredentialsFromEncryptedData f = new WindowsLoginCredentialsFromEncryptedData(new JCECrypto());

      LoginCredentials credentials = f.apply(new EncryptedPasswordAndPrivateKey(ENCRYPTED_PASSWORD, PRIVATE_KEY));

      assertEquals(credentials.getUser(), "Administrator");
      assertEquals(credentials.getPassword(), "u4.y9mb;nR.");
      assertFalse(credentials.getOptionalPrivateKey().isPresent());
   }
View Full Code Here

         serverLatestJobCompleted.apply(addedServer);
         client.getServerServices().power(addedServer.getName(), PowerCommand.START);
         serverLatestJobCompletedShort.apply(addedServer);
         addedServer = Iterables.getOnlyElement(client.getServerServices().getServersByName(addedServer.getName()));
      }
      LoginCredentials credentials = LoginCredentials.fromCredentials(client.getServerServices()
               .getServerCredentialsList().get(addedServer.getName()));
      return new NodeAndInitialCredentials<Server>(addedServer, addedServer.getId() + "", credentials);
   }
View Full Code Here

   }

   public void testLoginConsistentAcrossMultipleInjectorsAndLooksNice() throws IOException {
      Map<String, InputStream> map = getMap(createInjector());
      LoginCredentials creds = LoginCredentials.builder().user("user").password("pass").build();
      put(map, getStore(createInjector()), "test", creds);
      checkConsistent(map, getStore(createInjector()), "test", creds, "{\"user\":\"user\",\"password\":\"pass\"}");
      checkConsistent(map, getStore(createInjector()), "test", creds, "{\"user\":\"user\",\"password\":\"pass\"}");
      remove(map, getStore(createInjector()), "test");
   }
View Full Code Here

      remove(map, getStore(createInjector()), "test");
   }

   public void testLoginConsistentAcrossMultipleInjectorsAndLooksNiceWithSudo() throws IOException {
      Map<String, InputStream> map = getMap(createInjector());
      LoginCredentials creds = LoginCredentials.builder().user("user").password("pass").authenticateSudo(true).build();
      put(map, getStore(createInjector()), "test", creds);
      checkConsistent(map, getStore(createInjector()), "test", creds,
            "{\"user\":\"user\",\"password\":\"pass\",\"authenticateSudo\":true}");
      checkConsistent(map, getStore(createInjector()), "test", creds,
            "{\"user\":\"user\",\"password\":\"pass\",\"authenticateSudo\":true}");
View Full Code Here

         instanceTemplate.addNetworkInterface(options.getNetwork().get(), Type.ONE_TO_ONE_NAT);
      } else {
         instanceTemplate.addNetworkInterface(options.getNetwork().get());
      }

      LoginCredentials credentials = getFromImageAndOverrideIfRequired(template.getImage(), options);

      ImmutableMap.Builder<String, String> metadataBuilder = metatadaFromTemplateOptions.apply(options);
      instanceTemplate.metadata(metadataBuilder.build());
      instanceTemplate.serviceAccounts(options.getServiceAccounts());
      instanceTemplate.image(checkNotNull(template.getImage().getUri(), "image URI is null"));
View Full Code Here

      throw new UnsupportedOperationException("suspend is not supported by GCE");
   }

   private LoginCredentials getFromImageAndOverrideIfRequired(org.jclouds.compute.domain.Image image,
                                                              GoogleComputeEngineTemplateOptions options) {
      LoginCredentials defaultCredentials = image.getDefaultCredentials();
      String[] keys = defaultCredentials.getPrivateKey().split(":");
      String publicKey = keys[0];
      String privateKey = keys[1];

      LoginCredentials.Builder credentialsBuilder = defaultCredentials.toBuilder();
      credentialsBuilder.privateKey(privateKey);

      // LoginCredentials from image stores the public key along with the private key in the privateKey field
      // @see GoogleComputePopulateDefaultLoginCredentialsForImageStrategy
      // so if options doesn't have a public key set we set it from the default
      if (options.getPublicKey() == null) {
         options.authorizePublicKey(publicKey);
      }
      if (options.hasLoginPrivateKeyOption()) {
         credentialsBuilder.privateKey(options.getPrivateKey());
      }
      if (options.getLoginUser() != null) {
         credentialsBuilder.identity(options.getLoginUser());
      }
      if (options.hasLoginPasswordOption()) {
         credentialsBuilder.password(options.getLoginPassword());
      }
      if (options.shouldAuthenticateSudo() != null) {
         credentialsBuilder.authenticateSudo(options.shouldAuthenticateSudo());
      }
      LoginCredentials credentials = credentialsBuilder.build();
      options.overrideLoginCredentials(credentials);
      return credentials;
   }
View Full Code Here

      reconfigureNetworkInterfaces(masterMachine, guestOsUser, guestOsPassword, cloneSpec.getNetworkSpec(), clone);

      postConfigurations(clone, guestOsUser, guestOsPassword);

      LoginCredentials credentials = LoginCredentials.builder()
                                                     .user(guestOsUser)
                                                     .password(guestOsPassword)
                                                     .authenticateSudo(true)
                                                     .build();
      return new NodeAndInitialCredentials<IMachine>(clone, cloneName, credentials);
View Full Code Here

    public SshClient connectSsh() {
        if (!sshConfig.isEnabled()) {
            throw new IllegalStateException();
        }

        LoginCredentials credentials = sshConfig.getCredentials();
        SshClient ssh = cloudClient.connectSsh(instanceId, credentials);

        return ssh;
    }
View Full Code Here

      public NodeMetadata apply(NodeMetadata input) {
         if (statement == null)
            return input;
         Credentials credentials = CredentialsFromAdminAccess.INSTANCE.apply(statement);
         if (credentials != null) {
            LoginCredentials creds = LoginCredentials.fromCredentials(credentials);
            input = NodeMetadataBuilder.fromNodeMetadata(input).credentials(creds).build();
            credentialStore.put("node#" + input.getId(), input.getCredentials());
         }
         return input;
      }
View Full Code Here

TOP

Related Classes of org.jclouds.domain.LoginCredentials

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.