You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2018/01/11 15:41:22 UTC
[39/50] [abbrv] jclouds git commit: Add support for scoped
authentication
Add support for scoped authentication
Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/789687b0
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/789687b0
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/789687b0
Branch: refs/heads/keystonev3
Commit: 789687b0f49e45a39d3cb78876d75df205220082
Parents: 3c9e15a
Author: Ignasi Barrera <na...@apache.org>
Authored: Wed Dec 20 12:31:59 2017 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Thu Jan 11 16:21:30 2018 +0100
----------------------------------------------------------------------
.../keystone/auth/config/CredentialType.java | 1 -
.../keystone/auth/config/CredentialTypes.java | 2 -
.../auth/domain/TenantAndCredentials.java | 2 +
.../auth/functions/BaseAuthenticator.java | 7 +-
.../keystone/config/KeystoneProperties.java | 17 +++
.../openstack/keystone/v3/KeystoneApi.java | 26 +++-
.../keystone/v3/KeystoneApiMetadata.java | 5 +-
.../v3/binders/BindAuthToJsonPayload.java | 8 +-
.../binders/BindPasswordAuthToJsonPayload.java | 13 +-
.../v3/binders/BindTokenAuthToJsonPayload.java | 9 +-
.../v3/config/KeystoneHttpApiModule.java | 18 +--
.../v3/config/KeystoneParserModule.java | 31 -----
.../openstack/keystone/v3/domain/Auth.java | 53 ++++----
.../openstack/keystone/v3/domain/Project.java | 50 +++++++
.../openstack/keystone/v3/domain/User.java | 18 +--
.../openstack/keystone/v3/features/AuthApi.java | 83 ++++++++++++
.../keystone/v3/features/CatalogApi.java | 54 ++++++++
.../keystone/v3/features/ProjectApi.java | 50 +++++++
.../keystone/v3/features/RegionApi.java | 50 +++++++
.../keystone/v3/features/TokenApi.java | 135 -------------------
.../v3/parsers/ParseTokenFromHttpResponse.java | 2 +-
.../v3/auth/V3AuthenticationApiLiveTest.java | 1 +
.../keystone/v3/features/TokenApiLiveTest.java | 17 +--
.../keystone/v3/features/TokenApiMockTest.java | 10 +-
24 files changed, 411 insertions(+), 251 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialType.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialType.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialType.java
index 171426f..d395296 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialType.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialType.java
@@ -32,7 +32,6 @@ import javax.inject.Qualifier;
public @interface CredentialType {
/**
* @see CredentialTypes
- *
*/
String value();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialTypes.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialTypes.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialTypes.java
index ed9764a..7cfb6d7 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialTypes.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/config/CredentialTypes.java
@@ -44,12 +44,10 @@ public class CredentialTypes {
public static <T> Map<String, T> indexByCredentialType(Iterable<T> iterable) {
return Maps.uniqueIndex(iterable, new Function<T, String>() {
-
@Override
public String apply(T input) {
return credentialTypeOf(input);
}
-
});
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/domain/TenantAndCredentials.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/domain/TenantAndCredentials.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/domain/TenantAndCredentials.java
index 5988c67..caac935 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/domain/TenantAndCredentials.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/domain/TenantAndCredentials.java
@@ -29,6 +29,7 @@ public abstract class TenantAndCredentials<T> {
@Nullable public abstract String tenantId();
@Nullable public abstract String tenantName();
+ @Nullable public abstract String projectId();
public abstract T credentials();
TenantAndCredentials() {
@@ -43,6 +44,7 @@ public abstract class TenantAndCredentials<T> {
public abstract static class Builder<T> {
public abstract Builder<T> tenantId(String tenantId);
public abstract Builder<T> tenantName(String tenantName);
+ public abstract Builder<T> projectId(String projectId);
public abstract Builder<T> credentials(T credentials);
public abstract TenantAndCredentials<T> build();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/functions/BaseAuthenticator.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/functions/BaseAuthenticator.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/functions/BaseAuthenticator.java
index 05b2b94..7d07da4 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/functions/BaseAuthenticator.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/auth/functions/BaseAuthenticator.java
@@ -17,6 +17,7 @@
package org.jclouds.openstack.keystone.auth.functions;
import static com.google.common.base.Preconditions.checkState;
+import static org.jclouds.openstack.keystone.config.KeystoneProperties.PROJECT_ID;
import static org.jclouds.openstack.keystone.config.KeystoneProperties.REQUIRES_TENANT;
import static org.jclouds.openstack.keystone.config.KeystoneProperties.TENANT_ID;
import static org.jclouds.openstack.keystone.config.KeystoneProperties.TENANT_NAME;
@@ -49,6 +50,10 @@ public abstract class BaseAuthenticator<C> implements Function<Credentials, Auth
@Inject(optional = true)
@Named(REQUIRES_TENANT)
protected boolean requiresTenant;
+
+ @Inject(optional = true)
+ @Named(PROJECT_ID)
+ protected String projectId;
@PostConstruct
public void checkPropertiesAreCompatible() {
@@ -76,7 +81,7 @@ public abstract class BaseAuthenticator<C> implements Function<Credentials, Auth
C creds = createCredentials(usernameOrAccessKey, passwordOrSecretKeyOrToken);
TenantAndCredentials<C> credsWithTenant = TenantAndCredentials.<C> builder().tenantId(defaultTenantId)
- .tenantName(tenantName).credentials(creds).build();
+ .tenantName(tenantName).projectId(projectId).credentials(creds).build();
return authenticate(credsWithTenant);
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/config/KeystoneProperties.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/config/KeystoneProperties.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/config/KeystoneProperties.java
index ece0129..177bd92 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/config/KeystoneProperties.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/config/KeystoneProperties.java
@@ -17,6 +17,7 @@
package org.jclouds.openstack.keystone.config;
import org.jclouds.openstack.keystone.auth.config.CredentialTypes;
+import org.jclouds.rest.annotations.SinceApiVersion;
/**
* Configuration properties and constants used in Keystone connections.
@@ -64,6 +65,22 @@ public final class KeystoneProperties {
* @see <a href="http://wiki.openstack.org/CLIAuth">openstack docs</a>
*/
public static final String REQUIRES_TENANT = "jclouds.keystone.requires-tenant";
+
+ /**
+ * set this property to specify the authentication must be scoped to the project.
+ *
+ * @see <a href="http://wiki.openstack.org/CLIAuth">openstack docs</a>
+ */
+ @SinceApiVersion("3")
+ public static final String SCOPED_AUTH = "jclouds.keystone.scoped-auth";
+
+ /**
+ * set this property to specify project id to sue for scoped authentication.
+ * <p>
+ * if not present, jclouds will automatically scope the authentication to the current user's project
+ */
+ @SinceApiVersion("3")
+ public static final String PROJECT_ID = "jclouds.keystone.project-id";
/**
* type of the keystone service. ex. {@code compute}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApi.java
index 6c2bca5..d4c2176 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApi.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApi.java
@@ -18,7 +18,10 @@ package org.jclouds.openstack.keystone.v3;
import java.io.Closeable;
-import org.jclouds.openstack.keystone.v3.features.TokenApi;
+import org.jclouds.openstack.keystone.v3.features.AuthApi;
+import org.jclouds.openstack.keystone.v3.features.CatalogApi;
+import org.jclouds.openstack.keystone.v3.features.ProjectApi;
+import org.jclouds.openstack.keystone.v3.features.RegionApi;
import org.jclouds.rest.annotations.Delegate;
/**
@@ -27,9 +30,26 @@ import org.jclouds.rest.annotations.Delegate;
public interface KeystoneApi extends Closeable {
/**
- * Provides access to Token features
+ * Provides access to authentication and token management features.
*/
@Delegate
- TokenApi getTokenApi();
+ AuthApi getAuthApi();
+ /**
+ * Provides access to service catalog features.
+ */
+ @Delegate
+ CatalogApi getCatalogApi();
+
+ /**
+ * Provides access to region features.
+ */
+ @Delegate
+ RegionApi getRegionApi();
+
+ /**
+ * Provides access to project features.
+ */
+ @Delegate
+ ProjectApi getProjectApi();
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApiMetadata.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApiMetadata.java
index 52c400c..37da75a 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApiMetadata.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApiMetadata.java
@@ -28,7 +28,6 @@ import org.jclouds.openstack.keystone.auth.config.AuthenticationModule;
import org.jclouds.openstack.keystone.catalog.config.KeystoneAdminURLModule;
import org.jclouds.openstack.keystone.catalog.config.ServiceCatalogModule;
import org.jclouds.openstack.keystone.v3.config.KeystoneHttpApiModule;
-import org.jclouds.openstack.keystone.v3.config.KeystoneParserModule;
import org.jclouds.openstack.v2_0.ServiceType;
import org.jclouds.rest.internal.BaseHttpApiMetadata;
@@ -79,8 +78,8 @@ public class KeystoneApiMetadata extends BaseHttpApiMetadata<KeystoneApi> {
.add(AuthenticationModule.class)
.add(ServiceCatalogModule.class)
.add(KeystoneAdminURLModule.class)
- .add(KeystoneParserModule.class)
- .add(KeystoneHttpApiModule.class).build());
+ .add(KeystoneHttpApiModule.class)
+ .build());
}
@Override
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindAuthToJsonPayload.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindAuthToJsonPayload.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindAuthToJsonPayload.java
index f100988..84f754f 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindAuthToJsonPayload.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindAuthToJsonPayload.java
@@ -27,6 +27,8 @@ import org.jclouds.http.HttpRequest;
import org.jclouds.json.Json;
import org.jclouds.openstack.keystone.auth.domain.TenantAndCredentials;
import org.jclouds.openstack.keystone.v3.domain.Auth;
+import org.jclouds.openstack.keystone.v3.domain.Auth.Id;
+import org.jclouds.openstack.keystone.v3.domain.Auth.Scope;
import org.jclouds.rest.MapBinder;
import org.jclouds.rest.binders.BindToJsonPayload;
import org.jclouds.rest.internal.GeneratedHttpRequest;
@@ -40,7 +42,7 @@ public abstract class BindAuthToJsonPayload<T> extends BindToJsonPayload impleme
super(jsonBinder);
}
- protected abstract Auth buildAuth(TenantAndCredentials<T> credentials);
+ protected abstract Auth buildAuth(TenantAndCredentials<T> credentials, Scope scope);
@Override
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
@@ -53,7 +55,9 @@ public abstract class BindAuthToJsonPayload<T> extends BindToJsonPayload impleme
checkArgument(authentication.isPresent(), "no credentials found in the api call arguments");
@SuppressWarnings("unchecked")
- Auth auth = buildAuth((TenantAndCredentials<T>) authentication.get());
+ TenantAndCredentials<T> credentials = (TenantAndCredentials<T>) authentication.get();
+ Scope scope = credentials.projectId() == null ? null : Scope.create(Id.create(credentials.projectId()));
+ Auth auth = buildAuth(credentials, scope);
R authRequest = super.bindToRequest(request, ImmutableMap.of("auth", auth));
authRequest.getPayload().setSensitive(true);
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindPasswordAuthToJsonPayload.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindPasswordAuthToJsonPayload.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindPasswordAuthToJsonPayload.java
index 41f64bc..5f779c3 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindPasswordAuthToJsonPayload.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindPasswordAuthToJsonPayload.java
@@ -29,6 +29,7 @@ import org.jclouds.openstack.keystone.v3.domain.Auth.Identity;
import org.jclouds.openstack.keystone.v3.domain.Auth.Identity.PasswordAuth;
import org.jclouds.openstack.keystone.v3.domain.Auth.Identity.PasswordAuth.UserAuth;
import org.jclouds.openstack.keystone.v3.domain.Auth.Identity.PasswordAuth.UserAuth.DomainAuth;
+import org.jclouds.openstack.keystone.v3.domain.Auth.Scope;
@Singleton
public class BindPasswordAuthToJsonPayload extends BindAuthToJsonPayload<PasswordCredentials> {
@@ -39,12 +40,12 @@ public class BindPasswordAuthToJsonPayload extends BindAuthToJsonPayload<Passwor
}
@Override
- protected Auth buildAuth(TenantAndCredentials<PasswordCredentials> credentials) {
- return Auth.create(Identity.create(
- singletonList("password"),
- null,
- PasswordAuth.create(UserAuth.create(credentials.credentials().username(),
- DomainAuth.create(credentials.tenantName()), credentials.credentials().password()))));
+ protected Auth buildAuth(TenantAndCredentials<PasswordCredentials> credentials, Scope scope) {
+ PasswordCredentials creds = credentials.credentials();
+ DomainAuth domain = DomainAuth.create(credentials.tenantName());
+ UserAuth user = UserAuth.create(creds.username(), domain, creds.password());
+
+ return Auth.create(Identity.create(singletonList("password"), null, PasswordAuth.create(user)), scope);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindTokenAuthToJsonPayload.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindTokenAuthToJsonPayload.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindTokenAuthToJsonPayload.java
index 9d60fad..15dfb3d 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindTokenAuthToJsonPayload.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/binders/BindTokenAuthToJsonPayload.java
@@ -25,8 +25,9 @@ import org.jclouds.json.Json;
import org.jclouds.openstack.keystone.auth.domain.TenantAndCredentials;
import org.jclouds.openstack.keystone.auth.domain.TokenCredentials;
import org.jclouds.openstack.keystone.v3.domain.Auth;
+import org.jclouds.openstack.keystone.v3.domain.Auth.Id;
import org.jclouds.openstack.keystone.v3.domain.Auth.Identity;
-import org.jclouds.openstack.keystone.v3.domain.Auth.Identity.TokenAuth;
+import org.jclouds.openstack.keystone.v3.domain.Auth.Scope;
@Singleton
public class BindTokenAuthToJsonPayload extends BindAuthToJsonPayload<TokenCredentials> {
@@ -37,9 +38,9 @@ public class BindTokenAuthToJsonPayload extends BindAuthToJsonPayload<TokenCrede
}
@Override
- protected Auth buildAuth(TenantAndCredentials<TokenCredentials> credentials) {
- return Auth
- .create(Identity.create(singletonList("token"), TokenAuth.create(credentials.credentials().id()), null));
+ protected Auth buildAuth(TenantAndCredentials<TokenCredentials> credentials, Scope scope) {
+ Id token = Id.create(credentials.credentials().id());
+ return Auth.create(Identity.create(singletonList("token"), token, null), scope);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/config/KeystoneHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/config/KeystoneHttpApiModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/config/KeystoneHttpApiModule.java
index 6458726..1212680 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/config/KeystoneHttpApiModule.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/config/KeystoneHttpApiModule.java
@@ -16,34 +16,22 @@
*/
package org.jclouds.openstack.keystone.v3.config;
-import java.net.URI;
-
-import org.jclouds.openstack.keystone.v2_0.config.NamespaceAliases;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.json.config.GsonModule.DateAdapter;
import org.jclouds.openstack.keystone.v3.KeystoneApi;
import org.jclouds.rest.ConfiguresHttpApi;
import org.jclouds.rest.config.HttpApiModule;
-import com.google.inject.Binder;
-import com.google.inject.multibindings.MapBinder;
-
/**
* Configures the Keystone API.
*/
@ConfiguresHttpApi
public class KeystoneHttpApiModule extends HttpApiModule<KeystoneApi> {
- public KeystoneHttpApiModule() {
- }
-
- // Allow providers to cleanly contribute their own aliases
- public static MapBinder<URI, URI> namespaceAliasBinder(Binder binder) {
- return MapBinder.newMapBinder(binder, URI.class, URI.class, NamespaceAliases.class).permitDuplicates();
- }
-
@Override
protected void configure() {
super.configure();
- namespaceAliasBinder(binder());
+ bind(DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/config/KeystoneParserModule.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/config/KeystoneParserModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/config/KeystoneParserModule.java
deleted file mode 100644
index f76e28b..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/config/KeystoneParserModule.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.keystone.v3.config;
-
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.json.config.GsonModule.DateAdapter;
-
-import com.google.inject.AbstractModule;
-
-public class KeystoneParserModule extends AbstractModule {
-
- @Override
- protected void configure() {
- bind(DateAdapter.class).to(GsonModule.Iso8601DateAdapter.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Auth.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Auth.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Auth.java
index e716d35..aece0aa 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Auth.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Auth.java
@@ -25,40 +25,37 @@ import com.google.auto.value.AutoValue;
@AutoValue
public abstract class Auth {
-
public abstract Identity identity();
+ @Nullable public abstract Scope scope();
+
+ @SerializedNames({ "identity", "scope" })
+ public static Auth create(Identity identity, Scope scope) {
+ return new AutoValue_Auth(identity, scope);
+ }
+
+ @AutoValue
+ public abstract static class Id {
+ public abstract String id();
- @SerializedNames({ "identity" })
- public static Auth create(Identity identity) {
- return new AutoValue_Auth(identity);
+ @SerializedNames({ "id" })
+ public static Id create(String id) {
+ return new AutoValue_Auth_Id(id);
+ }
}
@AutoValue
public abstract static class Identity {
-
public abstract List<String> methods();
- @Nullable public abstract TokenAuth token();
+ @Nullable public abstract Id token();
@Nullable public abstract PasswordAuth password();
@SerializedNames({ "methods", "token", "password" })
- public static Identity create(List<String> methods, TokenAuth token, PasswordAuth password) {
+ public static Identity create(List<String> methods, Id token, PasswordAuth password) {
return new AutoValue_Auth_Identity(methods, token, password);
}
@AutoValue
- public abstract static class TokenAuth {
-
- public abstract String id();
-
- @SerializedNames({ "id" })
- public static TokenAuth create(String id) {
- return new AutoValue_Auth_Identity_TokenAuth(id);
- }
- }
-
- @AutoValue
- public abstract static class PasswordAuth {
-
+ public abstract static class PasswordAuth {
public abstract UserAuth user();
@SerializedNames({ "user" })
@@ -67,8 +64,7 @@ public abstract class Auth {
}
@AutoValue
- public abstract static class UserAuth {
-
+ public abstract static class UserAuth {
public abstract String name();
public abstract DomainAuth domain();
public abstract String password();
@@ -79,8 +75,7 @@ public abstract class Auth {
}
@AutoValue
- public abstract static class DomainAuth {
-
+ public abstract static class DomainAuth {
@Nullable public abstract String name();
@SerializedNames({ "name" })
@@ -91,4 +86,14 @@ public abstract class Auth {
}
}
}
+
+ @AutoValue
+ public abstract static class Scope {
+ public abstract Id project();
+
+ @SerializedNames({ "project" })
+ public static Scope create(Id id) {
+ return new AutoValue_Auth_Scope(id);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Project.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Project.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Project.java
new file mode 100644
index 0000000..c0b05c5
--- /dev/null
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/Project.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.keystone.v3.domain;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableList;
+
+@AutoValue
+public abstract class Project {
+
+ public abstract boolean isDomain();
+ @Nullable public abstract String description();
+ public abstract String domainId();
+ @Nullable public abstract String domainName();
+ public abstract boolean enabled();
+ public abstract String id();
+ public abstract String name();
+ @Nullable public abstract String parentId();
+ @Nullable public abstract List<String> tags();
+
+ @SerializedNames({ "is_domain", "description", "domain_id", "domain_name", "enabled", "id", "name", "parent_id",
+ "tags" })
+ public static Project create(boolean isDomain, String description, String domainId, String domainName,
+ boolean enabled, String id, String name, String parentId, List<String> tags) {
+ return new AutoValue_Project(isDomain, description, domainId, domainName, enabled, id, name, parentId,
+ tags == null ? null : ImmutableList.copyOf(tags));
+ }
+
+ Project() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/User.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/User.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/User.java
index 33702a9..171b7d1 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/User.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/domain/User.java
@@ -41,15 +41,15 @@ public abstract class User {
public abstract String id();
public abstract String name();
@Nullable public abstract Date passwordExpiresAt();
- public abstract Domain domain();
-
- @SerializedNames({"id", "name", "password_expires_at", "domain"})
- public static User create(String id,
- String name,
- Date passwordExpiresAt,
- Domain domain
- ) {
- return new AutoValue_User(id, name, passwordExpiresAt, domain);
+ @Nullable public abstract Domain domain();
+ @Nullable public abstract String domainId();
+ @Nullable public abstract String defaultProjectId();
+ @Nullable public abstract Boolean enabled();
+
+ @SerializedNames({ "id", "name", "password_expires_at", "domain", "domain_id", "default_project_id", "enabled" })
+ public static User create(String id, String name, Date passwordExpiresAt, Domain domain, String domainId,
+ String defaultProjectId, Boolean enabled) {
+ return new AutoValue_User(id, name, passwordExpiresAt, domain, domainId, defaultProjectId, enabled);
}
User() {
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/AuthApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/AuthApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/AuthApi.java
new file mode 100644
index 0000000..c9896f7
--- /dev/null
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/AuthApi.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.keystone.v3.features;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
+import org.jclouds.openstack.keystone.v3.domain.Token;
+import org.jclouds.openstack.keystone.v3.domain.User;
+import org.jclouds.openstack.v2_0.services.Identity;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.Headers;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+/**
+ * Provides access to the Keystone Authentication API.
+ */
+@Consumes(MediaType.APPLICATION_JSON)
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(Identity.class)
+@Path("/auth")
+public interface AuthApi {
+
+ /**
+ * Validate a token and, if it is valid, return access information regarding the tenant (though not the service catalog).
+ */
+ @Named("token:get")
+ @GET
+ @SelectJson("token")
+ @Path("/tokens")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ @Headers(keys = "X-Subject-Token", values = "{token}")
+ Token get(@PathParam("token") String token);
+
+ /**
+ * Validate a token and, if it is valid, return access information regarding the tenant (though not the service catalog).
+ */
+ @Named("token:getuser")
+ @GET
+ @SelectJson("user")
+ @Path("/tokens/{token}")
+ @Fallback(NullOnNotFoundOr404.class)
+ @Nullable
+ User getUserOfToken(@PathParam("token") String token);
+
+ /**
+ * Validate a token. This is a high-performance variant of the #getToken() call that does not return any further
+ * information.
+ */
+ @Named("token:check")
+ @HEAD
+ @Path("/tokens")
+ @Headers( keys = "X-Subject-Token", values = "{token}")
+ @Fallback(FalseOnNotFoundOr404.class)
+ boolean isValid(@PathParam("token") String token);
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/CatalogApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/CatalogApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/CatalogApi.java
new file mode 100644
index 0000000..c29f299
--- /dev/null
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/CatalogApi.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.keystone.v3.features;
+
+import java.util.List;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
+import org.jclouds.openstack.keystone.v3.domain.Endpoint;
+import org.jclouds.openstack.v2_0.services.Identity;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+/**
+ * Provides access to the Keystone Admin API.
+ */
+@Consumes(MediaType.APPLICATION_JSON)
+@RequestFilters(AuthenticateRequest.class)
+@org.jclouds.rest.annotations.Endpoint(Identity.class)
+public interface CatalogApi {
+
+ /**
+ * List all endpoints for a token.
+ * <p>
+ * NOTE: currently not working in openstack ( https://bugs.launchpad.net/keystone/+bug/988672 )
+ */
+ @Named("endpoints:list")
+ @GET
+ @SelectJson("endpoints")
+ @Path("/endpoints")
+ @Fallback(EmptyListOnNotFoundOr404.class)
+ List<Endpoint> endpoints();
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/ProjectApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/ProjectApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/ProjectApi.java
new file mode 100644
index 0000000..2089949
--- /dev/null
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/ProjectApi.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.keystone.v3.features;
+
+import java.util.List;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
+import org.jclouds.openstack.keystone.v3.domain.Project;
+import org.jclouds.openstack.v2_0.services.Identity;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+/**
+ * Provides access to the Keystone Projects API.
+ */
+@Consumes(MediaType.APPLICATION_JSON)
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(Identity.class)
+@Path("/projects")
+public interface ProjectApi {
+
+ @Named("projects:list")
+ @GET
+ @SelectJson("projects")
+ @Fallback(EmptyListOnNotFoundOr404.class)
+ List<Project> list();
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/RegionApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/RegionApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/RegionApi.java
new file mode 100644
index 0000000..cc87040
--- /dev/null
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/RegionApi.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.keystone.v3.features;
+
+import java.util.List;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
+import org.jclouds.openstack.keystone.v3.domain.Region;
+import org.jclouds.openstack.v2_0.services.Identity;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+/**
+ * Provides access to the Keystone Region API.
+ */
+@Consumes(MediaType.APPLICATION_JSON)
+@RequestFilters(AuthenticateRequest.class)
+@Endpoint(Identity.class)
+@Path("/regions")
+public interface RegionApi {
+
+ @Named("regions:list")
+ @GET
+ @SelectJson("regions")
+ @Fallback(EmptyListOnNotFoundOr404.class)
+ List<Region> list();
+}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/TokenApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/TokenApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/TokenApi.java
deleted file mode 100644
index 34d9b42..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/features/TokenApi.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.keystone.v3.features;
-
-import java.util.List;
-import java.util.Set;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
-import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
-import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-import org.jclouds.openstack.keystone.v2_0.domain.User;
-import org.jclouds.openstack.keystone.v3.domain.Region;
-import org.jclouds.openstack.keystone.v3.domain.Token;
-import org.jclouds.openstack.v2_0.services.Identity;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-
-/**
- * Provides access to the Keystone Admin API.
- */
-@Consumes(MediaType.APPLICATION_JSON)
-@RequestFilters(AuthenticateRequest.class)
-@org.jclouds.rest.annotations.Endpoint(Identity.class)
-public interface TokenApi {
-
- /**
- * Validate a token and, if it is valid, return access information regarding the tenant (though not the service catalog)/
- *
- * @return the requested information
- */
- @Named("token:get")
- @GET
- @SelectJson("token")
- @Path("/auth/tokens")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- @Headers( keys = "X-Subject-Token", values = "{token}")
- Token get(@PathParam("token") String token);
-
- /**
- * Validate a token and, if it is valid, return access information regarding the tenant (though not the service catalog)/
- *
- * @return the requested information
- */
- @Named("token:getuser")
- @GET
- @SelectJson("user")
- @Path("/auth/tokens/{token}")
- @Fallback(NullOnNotFoundOr404.class)
- @Nullable
- User getUserOfToken(@PathParam("token") String token);
-
- /**
- * Validate a token. This is a high-performance variant of the #getToken() call that does not return any further
- * information.
- *
- * @return true if the token is valid
- */
- @Named("token:check")
- @HEAD
- @Path("/auth/tokens")
- @Headers( keys = "X-Subject-Token", values = "{token}")
- @Fallback(FalseOnNotFoundOr404.class)
- boolean isValid(@PathParam("token") String token);
-
- /**
- * List all endpoints for a token
- * <p/>
- * NOTE: currently not working in openstack ( https://bugs.launchpad.net/keystone/+bug/988672 )
- *
- * @return the set of endpoints
- */
- @Named("token:listEndpoints")
- @GET
- @SelectJson("endpoints")
- @Path("/{token}/endpoints")
- @Fallback(EmptySetOnNotFoundOr404.class)
- Set<Endpoint> listEndpointsForToken(@PathParam("token") String token);
-
-
- /**
- * List all endpoints for a token
- * <p/>
- * NOTE: currently not working in openstack ( https://bugs.launchpad.net/keystone/+bug/988672 )
- *
- * @return the list of endpoints
- */
- @Named("token:endpoints")
- @GET
- @SelectJson("endpoints")
- @Path("/endpoints")
- @Fallback(EmptyListOnNotFoundOr404.class)
- List<Endpoint> endpoints();
-
- /**
- * List all regions for a token
- * <p/>
- *
- * @return the list of regions
- */
- @Named("token:regions")
- @GET
- @SelectJson("regions")
- @Path("/regions")
- @Fallback(EmptyListOnNotFoundOr404.class)
- List<Region> regions();
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/parsers/ParseTokenFromHttpResponse.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/parsers/ParseTokenFromHttpResponse.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/parsers/ParseTokenFromHttpResponse.java
index 9a5b799..1838900 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/parsers/ParseTokenFromHttpResponse.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/parsers/ParseTokenFromHttpResponse.java
@@ -35,7 +35,7 @@ public class ParseTokenFromHttpResponse implements Function<HttpResponse, Token>
private final ParseFirstJsonValueNamed<Token> parser;
@Inject
- public ParseTokenFromHttpResponse(GsonWrapper gsonView) {
+ ParseTokenFromHttpResponse(GsonWrapper gsonView) {
this.parser = new ParseFirstJsonValueNamed<Token>(gsonView, TypeLiteral.get(Token.class), "token");
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/auth/V3AuthenticationApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/auth/V3AuthenticationApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/auth/V3AuthenticationApiLiveTest.java
index 55b4216..d8a137e 100644
--- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/auth/V3AuthenticationApiLiveTest.java
+++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/auth/V3AuthenticationApiLiveTest.java
@@ -46,6 +46,7 @@ public class V3AuthenticationApiLiveTest extends BaseV3KeystoneApiLiveTest {
user = Iterables.get(Splitter.on(":").split(identity), 1);
context = newBuilder().modules(setupModules()).overrides(setupProperties())
.build(new TypeToken<ApiContext<KeystoneApi>>() {
+ private static final long serialVersionUID = 1L;
});
grabToken(context.utils().injector().getInstance(AuthenticateRequest.class));
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiLiveTest.java
index 79e9647..523f638 100644
--- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiLiveTest.java
+++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiLiveTest.java
@@ -16,17 +16,18 @@
*/
package org.jclouds.openstack.keystone.v3.features;
-import com.google.inject.Injector;
-import com.google.inject.Module;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Properties;
+
import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v3.KeystoneApi;
import org.jclouds.openstack.keystone.v3.internal.BaseV3KeystoneApiLiveTest;
import org.testng.annotations.Test;
-import java.util.Properties;
-
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
+import com.google.inject.Injector;
+import com.google.inject.Module;
@Test(groups = "live", testName = "TokenApiLiveTest")
public class TokenApiLiveTest extends BaseV3KeystoneApiLiveTest {
@@ -46,7 +47,7 @@ public class TokenApiLiveTest extends BaseV3KeystoneApiLiveTest {
assertNotNull(api().get(token));
}
- private TokenApi api() {
- return api.getTokenApi();
+ private AuthApi api() {
+ return api.getAuthApi();
}
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/789687b0/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiMockTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiMockTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiMockTest.java
index 118b2fd..57520fa 100644
--- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiMockTest.java
+++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v3/features/TokenApiMockTest.java
@@ -16,7 +16,8 @@
*/
package org.jclouds.openstack.keystone.v3.features;
-import java.util.Map;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
import org.jclouds.openstack.keystone.v3.domain.Token;
import org.jclouds.openstack.keystone.v3.internal.BaseV3KeystoneApiMockTest;
@@ -24,16 +25,13 @@ import org.testng.annotations.Test;
import com.google.common.reflect.TypeToken;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-
@Test(groups = "unit", testName = "TokenApiMockTest", singleThreaded = true)
public class TokenApiMockTest extends BaseV3KeystoneApiMockTest {
public void testGetToken() throws InterruptedException {
server.enqueue(jsonResponse("/v3/token.json").addHeader("X-Subject-Token", "bf583aefb74e45108346b4c1c8527a10"));
- Token token = api.getTokenApi().get("bf583aefb74e45108346b4c1c8527a10");
+ Token token = api.getAuthApi().get("bf583aefb74e45108346b4c1c8527a10");
assertEquals(token, tokenFromResource("/v3/token.json"));
@@ -44,7 +42,7 @@ public class TokenApiMockTest extends BaseV3KeystoneApiMockTest {
public void testGetTokenReturns404() throws InterruptedException {
server.enqueue(response404());
- Token token = api.getTokenApi().get("bf583aefb74e45108346b4c1c8527a10");
+ Token token = api.getAuthApi().get("bf583aefb74e45108346b4c1c8527a10");
assertNull(token);