Package org.jclouds.domain

Examples of org.jclouds.domain.Credentials


      Map<String, Object> locationMetadata = Maps.newHashMap();
      Location location = new LocationImpl(LocationScope.ZONE, "loc", "test location",
        null, new ArrayList<String>(), locationMetadata);
      Set<String> addresses = Sets.newHashSet();
      addresses.add("10.0.0.1");
      Credentials loginCredentials = new Credentials("id", "cred");

      Set<NodeMetadata> nodes = Sets.newHashSet();
      Map<?, Exception> executionExceptions = Maps.newHashMap();
      Map<NodeMetadata, Throwable> failedNodes = Maps.newHashMap();
      for (int i = 0; i < num; i++) {
View Full Code Here


        ImmutableMap.<String,String>of(), ImmutableSet.<String>of(), processors,
        1024, ImmutableList.<Volume>of(), null);
    when(node.getHardware()).thenReturn(hardware);
   
    Builder<Instance> instances = ImmutableSet.<Instance>builder();
    Instance master = new Instance(new Credentials("", ""),
        ImmutableSet.of(HadoopNameNodeClusterActionHandler.ROLE,
            HadoopJobTrackerClusterActionHandler.ROLE),
            "10.0.0.1", "10.0.0.1", "1", node);
    instances.add(master);
    for (int i = 0; i < numberOfWorkers; i++) {
      int id = i + 2;
      instances.add(new Instance(new Credentials("", ""),
        ImmutableSet.of(HadoopDataNodeClusterActionHandler.ROLE,
              HadoopTaskTrackerClusterActionHandler.ROLE),
              "10.0.0." + id, "10.0.0." + id, id + "", node));
    }
    return new Cluster(instances.build());
View Full Code Here

         builder.privateAddresses(ImmutableSet.of(input.getPrivateIp()));
      }

      // DigitalOcean does not provide a way to get the credentials.
      // Try to return them from the credential store
      Credentials credentials = credentialStore.get("node#" + input.getId());
      if (credentials instanceof LoginCredentials) {
         builder.credentials(LoginCredentials.class.cast(credentials));
      }

      return builder.build();
View Full Code Here

      new AuthenticationFilter(null);
   }

   public void testFilterWithCredentials() {
      HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://localhost/foo").build();
      Credentials credentials = LoginCredentials.builder().identity("foo").credential("bar").build();
      AuthenticationFilter filter = new AuthenticationFilter(Suppliers.ofInstance(credentials));

      HttpRequest filtered = filter.filter(request);

      String queryLine = filtered.getRequestLine().trim()
View Full Code Here

      this.credentials = checkNotNull(credentials, "credential supplier cannot be null");
   }

   @Override
   public HttpRequest filter(HttpRequest request) throws HttpException {
      Credentials creds = credentials.get();
      return request.toBuilder().addQueryParam(IDENTITY_PARAM, creds.identity)
            .addQueryParam(CREDENTIAL_PARAM, creds.credential).build();
   }
View Full Code Here

            @Backend final Supplier<Properties> overrides, final Closer closer) {
      return Suppliers.memoize(new Supplier<ComputeService>() {

         @Override
         public ComputeService get() {
            Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");
            ComputeServiceContext ctx = ContextBuilder.newBuilder(provider)
                  .credentials(currentCreds.identity, currentCreds.credential).overrides(overrides.get())
                  .modules(modules).buildView(ComputeServiceContext.class);
            closer.addToClose(ctx);
            return ctx.getComputeService();
View Full Code Here

      return sshClientFactory;
   }

   protected SshClient getConnection() {
      if (_connection == null) {
         Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");

         LoginCredentials credentials = new LoginCredentials.Builder().user(currentCreds.identity)
               .password(currentCreds.credential).build();

         _connection = getSshClientFactory().create(HostAndPort.fromParts(hostname, 22), credentials);
View Full Code Here

      this.creds = checkNotNull(creds, "creds");
   }

   @Override
   public HttpRequest filter(HttpRequest request) throws HttpException {
      Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");
      if (currentCreds.identity.indexOf(':') == -1) {
         throw new AuthorizationException(String.format("Identity %s does not match format tenantId:username",
               currentCreds.identity), null);
      }
      String tenantId = currentCreds.identity.substring(0, currentCreds.identity.indexOf(':'));
View Full Code Here

   /**
    * Test loading the credentials by extracting a pk from a PKCS12 keystore.
    */
   public static FGCPCredentials loadFGCPCredentials(File pathToPem) throws IOException, NoSuchAlgorithmException,
         CertificateException, InvalidKeySpecException {
      FGCPCredentialsSupplier loader = new FGCPCredentialsSupplier(ofInstance(new Credentials("foo",
            Files.asCharSource(pathToPem, Charsets.UTF_8).read())),
            new FGCPCredentialsForCredentials());
      return loader.get();
   }
View Full Code Here

      builder.publicAddresses(filter(addresses, not(IsPrivateIPAddress.INSTANCE)));
      builder.privateAddresses(filter(addresses, IsPrivateIPAddress.INSTANCE));

      // normally, we don't affect the credential store when reading vApps.
      // However, login user, etc, is actually in the metadata, so lets see
      Credentials fromApi = getCredentialsFrom(from);
      if (fromApi != null && !credentialStore.containsKey("node#" + from.getHref().toASCIIString()))
         credentialStore.put("node#" + from.getHref().toASCIIString(), fromApi);
      return builder.build();
   }
View Full Code Here

TOP

Related Classes of org.jclouds.domain.Credentials

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.