Package org.jclouds.openstack.keystone.v2_0.domain

Examples of org.jclouds.openstack.keystone.v2_0.domain.Token


   @Override
   public HttpRequest filter(HttpRequest request) throws HttpException {
      checkState(request instanceof GeneratedHttpRequest, "request must be an instance of GeneratedHttpRequest");
      GeneratedHttpRequest generatedHttpRequest = GeneratedHttpRequest.class.cast(request);
      TokenRequest tokenRequest = tokenRequestBuilder.apply(generatedHttpRequest);
      Token token = tokenFetcher.apply(tokenRequest);
      return request.toBuilder().addHeader("Authorization", String.format("%s %s",
              token.getTokenType(), token.getAccessToken())).build();

   }
View Full Code Here


      ClaimSet claimSet = ClaimSet.builder().addClaim("aud", audience).addClaim("scope", scopes).addClaim("iss",
              identity).emissionTime(now).expirationTime(now + 3600).build();

      TokenRequest tokenRequest = TokenRequest.builder().header(header).claimSet(claimSet).build();
      Token token = api.authenticate(tokenRequest);

      assertNotNull(token, "no token when authenticating " + tokenRequest);
   }
View Full Code Here

                                  .emissionTime(now)
                                  .expirationTime(now + 3600).build();

      TokenRequest tokenRequest = TokenRequest.builder().header(header).claimSet(claimSet).build();

      Token token = oauthApi.authenticate(tokenRequest);

      assertNotNull(token, "no token when authenticating " + tokenRequest);
   }
View Full Code Here

                                  .emissionTime(now)
                                  .expirationTime(now + 3600).build();

      TokenRequest tokenRequest = TokenRequest.builder().header(header).claimSet(claimSet).build();

      Token token = oauthApi.authenticate(tokenRequest);

      assertNotNull(token, "no token when authenticating " + tokenRequest);
   }
View Full Code Here

      ClaimSet claimSet = ClaimSet.builder().addClaim("aud", audience).addClaim("scope", scopes).addClaim("iss",
              identity).emissionTime(now).expirationTime(now + 3600).build();

      TokenRequest tokenRequest = TokenRequest.builder().header(header).claimSet(claimSet).build();
      Token token = api.authenticate(tokenRequest);

      assertNotNull(token, "no token when authenticating " + tokenRequest);
   }
View Full Code Here

   @Override
   public HttpRequest filter(HttpRequest request) throws HttpException {
      checkState(request instanceof GeneratedHttpRequest, "request must be an instance of GeneratedHttpRequest");
      GeneratedHttpRequest generatedHttpRequest = GeneratedHttpRequest.class.cast(request);
      TokenRequest tokenRequest = tokenRequestBuilder.apply(generatedHttpRequest);
      Token token = tokenFetcher.apply(tokenRequest);
      return request.toBuilder().addHeader("Authorization", String.format("%s %s",
              token.getTokenType(), token.getAccessToken())).build();

   }
View Full Code Here

                                  .emissionTime(now)
                                  .expirationTime(now + 3600).build();

      TokenRequest tokenRequest = TokenRequest.builder().header(header).claimSet(claimSet).build();

      Token token = oauthApi.authenticate(tokenRequest);

      assertNotNull(token, "no token when authenticating " + tokenRequest);
   }
View Full Code Here

      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/admin_extensions.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(201).setBody(
            stringFromResource("/user_create_response.json"))));

      try {
         KeystoneApi keystoneApi = api(server.getUrl("/").toString(), "openstack-keystone");
         UserAdminApi userAdminApi = keystoneApi.getUserAdminApi().get();
         CreateUserOptions createUserOptions = CreateUserOptions.Builder.email("john.smith@example.org").enabled(true);
         User testUser = userAdminApi.create("jqsmith", "jclouds-password", createUserOptions);

         assertNotNull(testUser);
         assertEquals(testUser.getId(), "u1000");
View Full Code Here

      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access_version_uids.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/admin_extensions.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(404)));

      try {
         KeystoneApi keystoneApi = api(server.getUrl("/").toString(), "openstack-keystone");
         UserAdminApi userAdminApi = keystoneApi.getUserAdminApi().get();
         CreateUserOptions createUserOptions = CreateUserOptions.Builder.email("john.smith@example.org").enabled(true);
         User testUser = userAdminApi.create("jqsmith", "jclouds-password", createUserOptions);

         assertNull(testUser);
View Full Code Here

      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/admin_extensions.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(200).setBody(
            stringFromResource("/user_update_response.json"))));

      try {
         KeystoneApi keystoneApi = api(server.getUrl("/").toString(), "openstack-keystone");
         UserAdminApi userAdminApi = keystoneApi.getUserAdminApi().get();
         UpdateUserOptions updateUserOptions = UpdateUserOptions.Builder.email("john.smith.renamed@example.org")
               .enabled(false).name("jqsmith-renamed").password("jclouds-password");
         User updatedUser = userAdminApi.update("u1000", updateUserOptions);

         assertNotNull(updatedUser);
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.keystone.v2_0.domain.Token

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.