From ec104454b1cc1e9d7b5f4f143544a743fb5c5eac Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 31 Jan 2012 19:53:04 -0800 Subject: [PATCH] Issue 825:add means to use login as opposed to signature authentication in cloudstack --- .../config/CloudStackProperties.java | 48 ++++ .../config/CloudStackRestClientModule.java | 212 +++++++++++++----- .../cloudstack/config/CredentialType.java | 46 ++++ .../features/AccountAsyncClient.java | 4 +- .../features/AddressAsyncClient.java | 4 +- .../features/AsyncJobAsyncClient.java | 4 +- .../features/ConfigurationAsyncClient.java | 4 +- .../features/DomainAccountAsyncClient.java | 4 +- .../features/DomainDomainAsyncClient.java | 4 +- .../features/DomainLimitAsyncClient.java | 4 +- .../features/DomainUserAsyncClient.java | 4 +- .../cloudstack/features/EventAsyncClient.java | 4 +- .../features/FirewallAsyncClient.java | 4 +- .../features/GlobalAccountAsyncClient.java | 4 +- .../features/GlobalAlertAsyncClient.java | 4 +- .../features/GlobalCapacityAsyncClient.java | 4 +- .../GlobalConfigurationAsyncClient.java | 4 +- .../features/GlobalDomainAsyncClient.java | 4 +- .../features/GlobalHostAsyncClient.java | 4 +- .../features/GlobalOfferingAsyncClient.java | 4 +- .../features/GlobalPodAsyncClient.java | 4 +- .../GlobalStoragePoolAsyncClient.java | 4 +- .../features/GlobalUsageAsyncClient.java | 4 +- .../features/GlobalUserAsyncClient.java | 4 +- .../features/GlobalVlanAsyncClient.java | 4 +- .../features/GlobalZoneAsyncClient.java | 4 +- .../features/GuestOSAsyncClient.java | 4 +- .../features/HypervisorAsyncClient.java | 4 +- .../cloudstack/features/ISOAsyncClient.java | 4 +- .../cloudstack/features/LimitAsyncClient.java | 4 +- .../features/LoadBalancerAsyncClient.java | 4 +- .../cloudstack/features/NATAsyncClient.java | 4 +- .../features/NetworkAsyncClient.java | 4 +- .../features/OfferingAsyncClient.java | 4 +- .../features/SSHKeyPairAsyncClient.java | 4 +- .../features/SecurityGroupAsyncClient.java | 4 +- .../features/SnapshotAsyncClient.java | 4 +- .../features/TemplateAsyncClient.java | 4 +- .../features/VMGroupAsyncClient.java | 4 +- .../features/VirtualMachineAsyncClient.java | 4 +- .../features/VolumeAsyncClient.java | 4 +- .../cloudstack/features/ZoneAsyncClient.java | 4 +- .../AddSessionKeyAndJSessionIdToRequest.java | 3 +- .../filters/AuthenticationFilter.java | 35 +++ .../cloudstack/filters/QuerySigner.java | 2 +- .../LoginWithPasswordCredentials.java | 62 +++++ .../RetryOnRenewAndLogoutOnClose.java | 92 ++++++++ .../PasswordAuthenticationExpectTest.java | 87 +++++++ .../BaseCloudStackRestClientExpectTest.java | 38 ++++ .../RetryOnRenewAndLogoutOnCloseTest.java | 65 ++++++ 50 files changed, 712 insertions(+), 134 deletions(-) create mode 100644 apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackProperties.java create mode 100644 apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CredentialType.java create mode 100644 apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/AuthenticationFilter.java create mode 100644 apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/LoginWithPasswordCredentials.java create mode 100644 apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/RetryOnRenewAndLogoutOnClose.java create mode 100644 apis/cloudstack/src/test/java/org/jclouds/cloudstack/PasswordAuthenticationExpectTest.java create mode 100644 apis/cloudstack/src/test/java/org/jclouds/cloudstack/handlers/RetryOnRenewAndLogoutOnCloseTest.java diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackProperties.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackProperties.java new file mode 100644 index 0000000000..3995f1cfd7 --- /dev/null +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackProperties.java @@ -0,0 +1,48 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.cloudstack.config; + +import org.jclouds.compute.ComputeServiceContextFactory; + +/** + * Configuration properties and constants used in CloudStack connections. + * + * @author Adrian Cole + */ +public interface CloudStackProperties { + + /** + * Type of credentials specified during {@link ComputeServiceContextFactory#createContext}. If + * {@link CredentialType#API_ACCESS_KEY_CREDENTIALS}, the request signing is used. If + * {@link CredentialType#PASSWORD_CREDENTIALS}, login will happen and a session will be + * persisted. + * + *

valid values

+ * + * + * @see CredentialType + * @see + */ + public static final String CREDENTIAL_TYPE = "jclouds.cloudstack.credential-type"; + +} diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java index 999f7025b7..556005556b 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CloudStackRestClientModule.java @@ -18,11 +18,16 @@ */ package org.jclouds.cloudstack.config; -import com.google.common.collect.ImmutableMap; -import com.google.inject.Provides; -import com.google.inject.Singleton; -import com.google.inject.TypeLiteral; -import com.google.inject.name.Named; +import static com.google.common.base.Throwables.propagate; + +import java.net.URI; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +import javax.ws.rs.core.UriBuilder; + +import org.jclouds.Constants; import org.jclouds.cloudstack.CloudStackAsyncClient; import org.jclouds.cloudstack.CloudStackClient; import org.jclouds.cloudstack.CloudStackDomainAsyncClient; @@ -30,6 +35,7 @@ import org.jclouds.cloudstack.CloudStackDomainClient; import org.jclouds.cloudstack.CloudStackGlobalAsyncClient; import org.jclouds.cloudstack.CloudStackGlobalClient; import org.jclouds.cloudstack.collections.Integration; +import org.jclouds.cloudstack.domain.LoginResponse; import org.jclouds.cloudstack.features.AccountAsyncClient; import org.jclouds.cloudstack.features.AccountClient; import org.jclouds.cloudstack.features.AddressAsyncClient; @@ -110,8 +116,16 @@ import org.jclouds.cloudstack.features.VolumeAsyncClient; import org.jclouds.cloudstack.features.VolumeClient; import org.jclouds.cloudstack.features.ZoneAsyncClient; import org.jclouds.cloudstack.features.ZoneClient; +import org.jclouds.cloudstack.filters.AddSessionKeyAndJSessionIdToRequest; +import org.jclouds.cloudstack.filters.AuthenticationFilter; +import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.functions.LoginWithPasswordCredentials; import org.jclouds.cloudstack.handlers.CloudStackErrorHandler; +import org.jclouds.cloudstack.handlers.RetryOnRenewAndLogoutOnClose; +import org.jclouds.concurrent.RetryOnTimeOutExceptionFunction; +import org.jclouds.domain.Credentials; import org.jclouds.http.HttpErrorHandler; +import org.jclouds.http.HttpRetryHandler; import org.jclouds.http.RequiresHttp; import org.jclouds.http.annotation.ClientError; import org.jclouds.http.annotation.Redirection; @@ -124,9 +138,17 @@ import org.jclouds.rest.config.BinderUtils; import org.jclouds.rest.config.RestClientModule; import org.jclouds.rest.internal.RestContextImpl; -import javax.ws.rs.core.UriBuilder; -import java.net.URI; -import java.util.Map; +import com.google.common.base.Function; +import com.google.common.base.Supplier; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.common.collect.ImmutableMap; +import com.google.inject.Inject; +import com.google.inject.Provides; +import com.google.inject.Singleton; +import com.google.inject.TypeLiteral; +import com.google.inject.name.Named; /** * Configures the cloudstack connection. @@ -138,47 +160,47 @@ import java.util.Map; public class CloudStackRestClientModule extends RestClientModule { public static final Map, Class> DELEGATE_MAP = ImmutableMap., Class> builder()// - .put(ZoneClient.class, ZoneAsyncClient.class)// - .put(GlobalZoneClient.class, GlobalZoneAsyncClient.class)// - .put(TemplateClient.class, TemplateAsyncClient.class)// - .put(OfferingClient.class, OfferingAsyncClient.class)// - .put(NetworkClient.class, NetworkAsyncClient.class)// - .put(VirtualMachineClient.class, VirtualMachineAsyncClient.class)// - .put(SecurityGroupClient.class, SecurityGroupAsyncClient.class)// - .put(AsyncJobClient.class, AsyncJobAsyncClient.class)// - .put(AddressClient.class, AddressAsyncClient.class)// - .put(NATClient.class, NATAsyncClient.class)// - .put(FirewallClient.class, FirewallAsyncClient.class)// - .put(LoadBalancerClient.class, LoadBalancerAsyncClient.class)// - .put(GuestOSClient.class, GuestOSAsyncClient.class)// - .put(HypervisorClient.class, HypervisorAsyncClient.class)// - .put(ConfigurationClient.class, ConfigurationAsyncClient.class)// - .put(GlobalConfigurationClient.class, GlobalConfigurationAsyncClient.class)// - .put(AccountClient.class, AccountAsyncClient.class)// - .put(DomainAccountClient.class, DomainAccountAsyncClient.class)// - .put(DomainUserClient.class, DomainUserAsyncClient.class)// - .put(DomainDomainClient.class, DomainDomainAsyncClient.class)// - .put(GlobalDomainClient.class, GlobalDomainAsyncClient.class)// - .put(GlobalAccountClient.class, GlobalAccountAsyncClient.class)// - .put(GlobalUserClient.class, GlobalUserAsyncClient.class)// - .put(EventClient.class, EventAsyncClient.class)// - .put(LimitClient.class, LimitAsyncClient.class)// - .put(DomainLimitClient.class, DomainLimitAsyncClient.class)// - .put(SSHKeyPairClient.class, SSHKeyPairAsyncClient.class)// - .put(VMGroupClient.class, VMGroupAsyncClient.class)// - .put(ISOClient.class, ISOAsyncClient.class)// - .put(VolumeClient.class, VolumeAsyncClient.class)// - .put(SnapshotClient.class, SnapshotAsyncClient.class)// - .put(GlobalAlertClient.class, GlobalAlertAsyncClient.class)// - .put(GlobalCapacityClient.class, GlobalCapacityAsyncClient.class)// - .put(GlobalOfferingClient.class, GlobalOfferingAsyncClient.class)// - .put(GlobalHostClient.class, GlobalHostAsyncClient.class)// - .put(GlobalStoragePoolClient.class, GlobalStoragePoolAsyncClient.class)// - .put(GlobalUsageClient.class, GlobalUsageAsyncClient.class)// - .put(GlobalPodClient.class, GlobalPodAsyncClient.class)// - .put(GlobalVlanClient.class, GlobalVlanAsyncClient.class)// - .put(SessionClient.class, SessionAsyncClient.class)// - .build(); + .put(ZoneClient.class, ZoneAsyncClient.class)// + .put(GlobalZoneClient.class, GlobalZoneAsyncClient.class)// + .put(TemplateClient.class, TemplateAsyncClient.class)// + .put(OfferingClient.class, OfferingAsyncClient.class)// + .put(NetworkClient.class, NetworkAsyncClient.class)// + .put(VirtualMachineClient.class, VirtualMachineAsyncClient.class)// + .put(SecurityGroupClient.class, SecurityGroupAsyncClient.class)// + .put(AsyncJobClient.class, AsyncJobAsyncClient.class)// + .put(AddressClient.class, AddressAsyncClient.class)// + .put(NATClient.class, NATAsyncClient.class)// + .put(FirewallClient.class, FirewallAsyncClient.class)// + .put(LoadBalancerClient.class, LoadBalancerAsyncClient.class)// + .put(GuestOSClient.class, GuestOSAsyncClient.class)// + .put(HypervisorClient.class, HypervisorAsyncClient.class)// + .put(ConfigurationClient.class, ConfigurationAsyncClient.class)// + .put(GlobalConfigurationClient.class, GlobalConfigurationAsyncClient.class)// + .put(AccountClient.class, AccountAsyncClient.class)// + .put(DomainAccountClient.class, DomainAccountAsyncClient.class)// + .put(DomainUserClient.class, DomainUserAsyncClient.class)// + .put(DomainDomainClient.class, DomainDomainAsyncClient.class)// + .put(GlobalDomainClient.class, GlobalDomainAsyncClient.class)// + .put(GlobalAccountClient.class, GlobalAccountAsyncClient.class)// + .put(GlobalUserClient.class, GlobalUserAsyncClient.class)// + .put(EventClient.class, EventAsyncClient.class)// + .put(LimitClient.class, LimitAsyncClient.class)// + .put(DomainLimitClient.class, DomainLimitAsyncClient.class)// + .put(SSHKeyPairClient.class, SSHKeyPairAsyncClient.class)// + .put(VMGroupClient.class, VMGroupAsyncClient.class)// + .put(ISOClient.class, ISOAsyncClient.class)// + .put(VolumeClient.class, VolumeAsyncClient.class)// + .put(SnapshotClient.class, SnapshotAsyncClient.class)// + .put(GlobalAlertClient.class, GlobalAlertAsyncClient.class)// + .put(GlobalCapacityClient.class, GlobalCapacityAsyncClient.class)// + .put(GlobalOfferingClient.class, GlobalOfferingAsyncClient.class)// + .put(GlobalHostClient.class, GlobalHostAsyncClient.class)// + .put(GlobalStoragePoolClient.class, GlobalStoragePoolAsyncClient.class)// + .put(GlobalUsageClient.class, GlobalUsageAsyncClient.class)// + .put(GlobalPodClient.class, GlobalPodAsyncClient.class)// + .put(GlobalVlanClient.class, GlobalVlanAsyncClient.class)// + .put(SessionClient.class, SessionAsyncClient.class)// + .build(); @Override protected void bindAsyncClient() { @@ -214,6 +236,8 @@ public class CloudStackRestClientModule extends RestClientModule>() { }); install(new CloudStackParserModule()); + bind(CredentialType.class).toProvider(CredentialTypeFromPropertyOrDefault.class); + bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(RetryOnRenewAndLogoutOnClose.class); super.configure(); } @@ -228,9 +252,91 @@ public class CloudStackRestClientModule extends RestClientModule uriBuilder) { - return uriBuilder.get().scheme(normal.getScheme()) - .host(normal.getHost()).path("/").port(port).build(); + @Named("jclouds.cloudstack.integration-api-port") int port, + com.google.inject.Provider uriBuilder) { + return uriBuilder.get().scheme(normal.getScheme()).host(normal.getHost()).path("/").port(port).build(); + } + + /** + * Session client is used in login-related functionality + */ + @Provides + @Singleton + protected SessionClient bindSessionClient(CloudStackClient client) { + return client.getSessionClient(); + } + + @Singleton + static class CredentialTypeFromPropertyOrDefault implements javax.inject.Provider { + /** + * use optional injection to supply a default value for credential type. so that we don't have + * to set a default property. + */ + @Inject(optional = true) + @Named(CloudStackProperties.CREDENTIAL_TYPE) + String credentialType = CredentialType.API_ACCESS_KEY_CREDENTIALS.toString(); + + @Override + public CredentialType get() { + return CredentialType.fromValue(credentialType); + } + } + + /** + * we use the type of credentials specified at login to determine which way we want to filter the + * request.
+ * for ex, if we are getting passwords, we know we will need to login/logout. Otherwise we are + * signing requests. + */ + @Provides + @Singleton + protected AuthenticationFilter authenticationFilterForCredentialType(CredentialType credentialType, + AddSessionKeyAndJSessionIdToRequest addSessionKeyAndJSessionIdToRequest, QuerySigner querySigner) { + switch (credentialType) { + case PASSWORD_CREDENTIALS: + return addSessionKeyAndJSessionIdToRequest; + case API_ACCESS_KEY_CREDENTIALS: + return querySigner; + default: + throw new IllegalArgumentException("credential type not supported: " + credentialType); + } + } + + @Provides + @Singleton + protected Function makeSureFilterRetriesOnTimeout( + LoginWithPasswordCredentials loginWithPasswordCredentials) { + // we should retry on timeout exception logging in. + return new RetryOnTimeOutExceptionFunction(loginWithPasswordCredentials); + } + + // TODO: not sure we can action the timeout from loginresponse without extra code? modify default + // accordingly + // PROPERTY_SESSION_INTERVAL is default to 60 seconds + @Provides + @Singleton + public LoadingCache provideLoginResponseCache( + Function getLoginResponse, + @Named(Constants.PROPERTY_SESSION_INTERVAL) int seconds) { + return CacheBuilder.newBuilder().expireAfterWrite(seconds, TimeUnit.SECONDS).build( + CacheLoader.from(getLoginResponse)); + } + + // Temporary conversion of a cache to a supplier until there is a single-element cache + // http://code.google.com/p/guava-libraries/issues/detail?id=872 + @Provides + @Singleton + protected Supplier provideLoginResponseSupplier(final LoadingCache cache, + @Provider final Credentials creds) { + return new Supplier() { + @Override + public LoginResponse get() { + try { + return cache.get(creds); + } catch (ExecutionException e) { + throw propagate(e.getCause()); + } + } + }; } } diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CredentialType.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CredentialType.java new file mode 100644 index 0000000000..4c88217d6a --- /dev/null +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/config/CredentialType.java @@ -0,0 +1,46 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.cloudstack.config; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.base.CaseFormat; + +/** + * Decides what type of credentials createContext is supplied with. + * + * @author Adrian Cole + */ +public enum CredentialType { + + API_ACCESS_KEY_CREDENTIALS, + + PASSWORD_CREDENTIALS; + + @Override + public String toString() { + return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name()); + } + + public static CredentialType fromValue(String credentialType) { + return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(credentialType, + "credentialType"))); + } + +} diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AccountAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AccountAsyncClient.java index 0e61824f9f..f4dd80bb17 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AccountAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AccountAsyncClient.java @@ -26,7 +26,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.Account; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListAccountsOptions; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.OnlyElement; @@ -46,7 +46,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see
* @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface AccountAsyncClient { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AddressAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AddressAsyncClient.java index dc2913f952..f69ab292c3 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AddressAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AddressAsyncClient.java @@ -27,7 +27,7 @@ import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.PublicIPAddress; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.functions.ReturnVoidOnNotFoundOr404OrUnableToFindAccountOwner; import org.jclouds.cloudstack.options.AssociateIPAddressOptions; import org.jclouds.cloudstack.options.ListPublicIPAddressesOptions; @@ -50,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface AddressAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AsyncJobAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AsyncJobAsyncClient.java index 18f90b9070..69c1e896c7 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AsyncJobAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/AsyncJobAsyncClient.java @@ -26,7 +26,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.AsyncJob; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.functions.ParseAsyncJobFromHttpResponse; import org.jclouds.cloudstack.functions.ParseAsyncJobsFromHttpResponse; import org.jclouds.cloudstack.options.ListAsyncJobsOptions; @@ -47,7 +47,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface AsyncJobAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ConfigurationAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ConfigurationAsyncClient.java index 537d04191f..970aba73a6 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ConfigurationAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ConfigurationAsyncClient.java @@ -23,7 +23,7 @@ import javax.ws.rs.GET; import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.Capabilities; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.SelectJson; @@ -38,7 +38,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface ConfigurationAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountAsyncClient.java index 66d720da47..2990634ab0 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainAccountAsyncClient.java @@ -21,7 +21,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.Account; import org.jclouds.cloudstack.domain.AsyncCreateResponse; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.RequestFilters; @@ -43,7 +43,7 @@ import javax.ws.rs.core.MediaType; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Domain_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface DomainAccountAsyncClient extends AccountAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainDomainAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainDomainAsyncClient.java index cbb620b94c..c2567a8632 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainDomainAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainDomainAsyncClient.java @@ -20,7 +20,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.Domain; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListDomainChildrenOptions; import org.jclouds.cloudstack.options.ListDomainsOptions; import org.jclouds.rest.annotations.ExceptionParser; @@ -46,7 +46,7 @@ import java.util.Set; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Domain_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface DomainDomainAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainLimitAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainLimitAsyncClient.java index d497dc43cb..89c2c825a0 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainLimitAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainLimitAsyncClient.java @@ -24,7 +24,7 @@ import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.binders.ResourceLimitToQueryParams; import org.jclouds.cloudstack.domain.ResourceLimit; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.RequestFilters; @@ -41,7 +41,7 @@ import com.google.common.util.concurrent.ListenableFuture; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Domain_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface DomainLimitAsyncClient extends LimitAsyncClient { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainUserAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainUserAsyncClient.java index e6cefefc7c..6803b2b473 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainUserAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/DomainUserAsyncClient.java @@ -21,7 +21,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.User; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListUsersOptions; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.QueryParams; @@ -46,7 +46,7 @@ import java.util.Set; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Domain_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface DomainUserAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/EventAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/EventAsyncClient.java index 4ee53ec393..a9201deecb 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/EventAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/EventAsyncClient.java @@ -25,7 +25,7 @@ import java.util.Set; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.Event; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse; import org.jclouds.cloudstack.options.ListEventsOptions; import org.jclouds.rest.annotations.ExceptionParser; @@ -43,7 +43,7 @@ import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; * @see org.jclouds.cloudstack.features.AccountClient * @see */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface EventAsyncClient { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/FirewallAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/FirewallAsyncClient.java index 5c9ef48e80..6441a52ceb 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/FirewallAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/FirewallAsyncClient.java @@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.FirewallRule; import org.jclouds.cloudstack.domain.PortForwardingRule; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateFirewallRuleOptions; import org.jclouds.cloudstack.options.ListFirewallRulesOptions; import org.jclouds.cloudstack.options.ListPortForwardingRulesOptions; @@ -52,7 +52,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see FirewallClient * @see */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface FirewallAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalAccountAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalAccountAsyncClient.java index 27c9507d44..518d814b40 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalAccountAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalAccountAsyncClient.java @@ -24,7 +24,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.Account; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateAccountOptions; import org.jclouds.cloudstack.options.UpdateAccountOptions; import org.jclouds.rest.annotations.ExceptionParser; @@ -44,7 +44,7 @@ import com.google.common.util.concurrent.ListenableFuture; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalAccountAsyncClient extends DomainAccountAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalAlertAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalAlertAsyncClient.java index f19fff3c12..6153248b8d 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalAlertAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalAlertAsyncClient.java @@ -20,7 +20,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.Alert; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListAlertsOptions; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.QueryParams; @@ -42,7 +42,7 @@ import java.util.Set; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalAlertAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalCapacityAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalCapacityAsyncClient.java index 62381ded94..523d130116 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalCapacityAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalCapacityAsyncClient.java @@ -20,7 +20,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.Capacity; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListCapacityOptions; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.QueryParams; @@ -42,7 +42,7 @@ import java.util.Set; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalCapacityAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalConfigurationAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalConfigurationAsyncClient.java index 21212e3812..8e7de2a46a 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalConfigurationAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalConfigurationAsyncClient.java @@ -20,7 +20,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.ConfigurationEntry; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListConfigurationEntriesOptions; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.OnlyElement; @@ -45,7 +45,7 @@ import java.util.Set; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalConfigurationAsyncClient extends ConfigurationAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalDomainAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalDomainAsyncClient.java index a1bbc82be8..eb6dbbfe6f 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalDomainAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalDomainAsyncClient.java @@ -20,7 +20,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.Domain; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateDomainOptions; import org.jclouds.cloudstack.options.UpdateDomainOptions; import org.jclouds.rest.annotations.ExceptionParser; @@ -44,7 +44,7 @@ import javax.ws.rs.core.MediaType; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalDomainAsyncClient extends DomainDomainAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalHostAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalHostAsyncClient.java index 7085302d30..6814a23ac7 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalHostAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalHostAsyncClient.java @@ -21,7 +21,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.Cluster; import org.jclouds.cloudstack.domain.Host; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.AddClusterOptions; import org.jclouds.cloudstack.options.AddHostOptions; import org.jclouds.cloudstack.options.AddSecondaryStorageOptions; @@ -50,7 +50,7 @@ import java.util.Set; * @see * @author Andrei Savu */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalHostAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClient.java index 1483459665..d6a80362fd 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClient.java @@ -26,7 +26,7 @@ import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.DiskOffering; import org.jclouds.cloudstack.domain.NetworkOffering; import org.jclouds.cloudstack.domain.ServiceOffering; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateDiskOfferingOptions; import org.jclouds.cloudstack.options.CreateServiceOfferingOptions; import org.jclouds.cloudstack.options.UpdateDiskOfferingOptions; @@ -48,7 +48,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Andrei Savu */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalOfferingAsyncClient extends OfferingAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalPodAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalPodAsyncClient.java index 76219e5eb3..5aef4f2dfc 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalPodAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalPodAsyncClient.java @@ -20,7 +20,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.Pod; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreatePodOptions; import org.jclouds.cloudstack.options.ListPodsOptions; import org.jclouds.cloudstack.options.UpdatePodOptions; @@ -48,7 +48,7 @@ import java.util.Set; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalPodAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClient.java index a3d13c5852..07868fb546 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClient.java @@ -20,7 +20,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.StoragePool; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListStoragePoolsOptions; import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.RequestFilters; @@ -40,7 +40,7 @@ import java.util.Set; * @see * @author Richard Downer */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") @SkipEncoding({'/'}) public interface GlobalStoragePoolAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUsageAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUsageAsyncClient.java index 9a21188deb..ac68dc40a2 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUsageAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUsageAsyncClient.java @@ -21,7 +21,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.JobResult; import org.jclouds.cloudstack.domain.UsageRecord; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.functions.DateToYyyyMmDd; import org.jclouds.cloudstack.options.GenerateUsageRecordsOptions; import org.jclouds.cloudstack.options.ListUsageRecordsOptions; @@ -45,7 +45,7 @@ import java.util.Set; * @see * @author Richard Downer */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalUsageAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUserAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUserAsyncClient.java index abe98381ea..980c8bbe32 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUserAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalUserAsyncClient.java @@ -22,7 +22,7 @@ import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.collections.Integration; import org.jclouds.cloudstack.domain.ApiKeyPair; import org.jclouds.cloudstack.domain.User; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateUserOptions; import org.jclouds.cloudstack.options.UpdateUserOptions; import org.jclouds.rest.annotations.Endpoint; @@ -46,7 +46,7 @@ import javax.ws.rs.core.MediaType; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalUserAsyncClient extends DomainUserAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalVlanAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalVlanAsyncClient.java index 878199378a..e4f7803237 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalVlanAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalVlanAsyncClient.java @@ -20,7 +20,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.VlanIPRange; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateVlanIPRangeOptions; import org.jclouds.cloudstack.options.ListVlanIPRangesOptions; import org.jclouds.rest.annotations.ExceptionParser; @@ -46,7 +46,7 @@ import java.util.Set; * @see * @author Richard Downer */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalVlanAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalZoneAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalZoneAsyncClient.java index d6c068b7bb..9a7fdd453d 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalZoneAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalZoneAsyncClient.java @@ -21,7 +21,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.NetworkType; import org.jclouds.cloudstack.domain.Zone; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateZoneOptions; import org.jclouds.cloudstack.options.UpdateZoneOptions; import org.jclouds.rest.annotations.ExceptionParser; @@ -45,7 +45,7 @@ import javax.ws.rs.core.MediaType; * "http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_Global_Admin.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GlobalZoneAsyncClient extends ZoneAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GuestOSAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GuestOSAsyncClient.java index e5e69a939b..4023359b5f 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GuestOSAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GuestOSAsyncClient.java @@ -27,7 +27,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.OSType; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.functions.ParseIdToNameEntryFromHttpResponse; import org.jclouds.cloudstack.functions.ParseIdToNameFromHttpResponse; import org.jclouds.cloudstack.options.ListOSTypesOptions; @@ -50,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface GuestOSAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/HypervisorAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/HypervisorAsyncClient.java index ac14d6e005..0655331019 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/HypervisorAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/HypervisorAsyncClient.java @@ -23,7 +23,7 @@ import java.util.Set; import javax.ws.rs.GET; import javax.ws.rs.QueryParam; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.QueryParams; @@ -41,7 +41,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface HypervisorAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ISOAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ISOAsyncClient.java index e8fb5f90d5..196cd07240 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ISOAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ISOAsyncClient.java @@ -29,7 +29,7 @@ import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.ExtractMode; import org.jclouds.cloudstack.domain.ISO; import org.jclouds.cloudstack.domain.ISOPermissions; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.AccountInDomainOptions; import org.jclouds.cloudstack.options.DeleteISOOptions; import org.jclouds.cloudstack.options.ExtractISOOptions; @@ -54,7 +54,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see http://download.cloud.com/releases/2.2.12/api/TOC_User.html * @author Richard Downer */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") @SkipEncoding({'/', ','}) public interface ISOAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/LimitAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/LimitAsyncClient.java index 496430925e..b1df6fb0ac 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/LimitAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/LimitAsyncClient.java @@ -25,7 +25,7 @@ import javax.ws.rs.GET; import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.ResourceLimit; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListResourceLimitsOptions; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.QueryParams; @@ -43,7 +43,7 @@ import com.google.common.util.concurrent.ListenableFuture; * href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface LimitAsyncClient { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/LoadBalancerAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/LoadBalancerAsyncClient.java index da9b8215df..670e2698fb 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/LoadBalancerAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/LoadBalancerAsyncClient.java @@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.LoadBalancerRule; import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm; import org.jclouds.cloudstack.domain.VirtualMachine; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateLoadBalancerRuleOptions; import org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions; import org.jclouds.cloudstack.options.UpdateLoadBalancerRuleOptions; @@ -52,7 +52,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface LoadBalancerAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/NATAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/NATAsyncClient.java index 2c33eb7a56..cef3d62fc3 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/NATAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/NATAsyncClient.java @@ -27,7 +27,7 @@ import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.IPForwardingRule; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateIPForwardingRuleOptions; import org.jclouds.cloudstack.options.ListIPForwardingRulesOptions; import org.jclouds.rest.annotations.ExceptionParser; @@ -51,7 +51,7 @@ import com.google.common.util.concurrent.ListenableFuture; * /> * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface NATAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/NetworkAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/NetworkAsyncClient.java index 20021c1dc7..ff627ff882 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/NetworkAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/NetworkAsyncClient.java @@ -26,7 +26,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.Network; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateNetworkOptions; import org.jclouds.cloudstack.options.ListNetworksOptions; import org.jclouds.rest.annotations.ExceptionParser; @@ -47,7 +47,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface NetworkAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/OfferingAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/OfferingAsyncClient.java index 86c6e7da77..43646e5911 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/OfferingAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/OfferingAsyncClient.java @@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.DiskOffering; import org.jclouds.cloudstack.domain.NetworkOffering; import org.jclouds.cloudstack.domain.ServiceOffering; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListDiskOfferingsOptions; import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions; import org.jclouds.cloudstack.options.ListServiceOfferingsOptions; @@ -50,7 +50,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface OfferingAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SSHKeyPairAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SSHKeyPairAsyncClient.java index 785f8741b5..c2501d8166 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SSHKeyPairAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SSHKeyPairAsyncClient.java @@ -26,7 +26,7 @@ import java.util.Set; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.SshKeyPair; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListSSHKeyPairsOptions; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.OnlyElement; @@ -45,7 +45,7 @@ import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; * href="http://download.cloud.com/releases/2.2.0/api_2.2.8/TOC_User.html" * /> */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface SSHKeyPairAsyncClient { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SecurityGroupAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SecurityGroupAsyncClient.java index e6312bcd63..f223b57b1d 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SecurityGroupAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SecurityGroupAsyncClient.java @@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.binders.BindAccountSecurityGroupPairsToIndexedQueryParams; import org.jclouds.cloudstack.binders.BindCIDRsToCommaDelimitedQueryParam; import org.jclouds.cloudstack.domain.SecurityGroup; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.AccountInDomainOptions; import org.jclouds.cloudstack.options.ListSecurityGroupsOptions; import org.jclouds.rest.annotations.BinderParam; @@ -52,7 +52,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface SecurityGroupAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SnapshotAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SnapshotAsyncClient.java index ca1d993dee..9a8be7c3af 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SnapshotAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/SnapshotAsyncClient.java @@ -25,7 +25,7 @@ import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.Snapshot; import org.jclouds.cloudstack.domain.SnapshotPolicy; import org.jclouds.cloudstack.domain.SnapshotPolicySchedule; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateSnapshotOptions; import org.jclouds.cloudstack.options.ListSnapshotPoliciesOptions; import org.jclouds.cloudstack.options.ListSnapshotsOptions; @@ -54,7 +54,7 @@ import java.util.Set; * @see http://download.cloud.com/releases/2.2.0/api/TOC_User.html * @author Richard Downer */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface SnapshotAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateAsyncClient.java index c96c871ae6..f0b054a2a6 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/TemplateAsyncClient.java @@ -31,7 +31,7 @@ import org.jclouds.cloudstack.domain.ExtractMode; import org.jclouds.cloudstack.domain.Template; import org.jclouds.cloudstack.domain.TemplateMetadata; import org.jclouds.cloudstack.domain.TemplatePermission; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.AccountInDomainOptions; import org.jclouds.cloudstack.options.CreateTemplateOptions; import org.jclouds.cloudstack.options.DeleteTemplateOptions; @@ -63,7 +63,7 @@ import com.google.common.util.concurrent.ListenableFuture; * /> * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") @SkipEncoding(',') public interface TemplateAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupAsyncClient.java index 641e21b84d..cdd68c3844 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VMGroupAsyncClient.java @@ -20,7 +20,7 @@ package org.jclouds.cloudstack.features; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.VMGroup; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.CreateVMGroupOptions; import org.jclouds.cloudstack.options.ListVMGroupsOptions; import org.jclouds.cloudstack.options.UpdateVMGroupOptions; @@ -43,7 +43,7 @@ import java.util.Set; * @see VMGroupClient * @see */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface VMGroupAsyncClient { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClient.java index b63d402afc..fec2366804 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VirtualMachineAsyncClient.java @@ -27,7 +27,7 @@ import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.VirtualMachine; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.DeployVirtualMachineOptions; import org.jclouds.cloudstack.options.ListVirtualMachinesOptions; import org.jclouds.rest.annotations.ExceptionParser; @@ -49,7 +49,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface VirtualMachineAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeAsyncClient.java index 3f7a6d0a72..85165f3c6b 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/VolumeAsyncClient.java @@ -27,7 +27,7 @@ import java.util.Set; import com.google.common.util.concurrent.ListenableFuture; import org.jclouds.cloudstack.domain.AsyncCreateResponse; import org.jclouds.cloudstack.domain.Volume; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListVolumesOptions; import org.jclouds.rest.annotations.*; import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; @@ -42,7 +42,7 @@ import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; * @see org.jclouds.cloudstack.features.VolumeClient * @see */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface VolumeAsyncClient { /** diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneAsyncClient.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneAsyncClient.java index be974236a0..f18fdaf4ce 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneAsyncClient.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/ZoneAsyncClient.java @@ -26,7 +26,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.jclouds.cloudstack.domain.Zone; -import org.jclouds.cloudstack.filters.QuerySigner; +import org.jclouds.cloudstack.filters.AuthenticationFilter; import org.jclouds.cloudstack.options.ListZonesOptions; import org.jclouds.rest.annotations.ExceptionParser; import org.jclouds.rest.annotations.OnlyElement; @@ -46,7 +46,7 @@ import com.google.common.util.concurrent.ListenableFuture; * @see * @author Adrian Cole */ -@RequestFilters(QuerySigner.class) +@RequestFilters(AuthenticationFilter.class) @QueryParams(keys = "response", values = "json") public interface ZoneAsyncClient { diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/AddSessionKeyAndJSessionIdToRequest.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/AddSessionKeyAndJSessionIdToRequest.java index 182aa9abeb..7e9385aa7c 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/AddSessionKeyAndJSessionIdToRequest.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/AddSessionKeyAndJSessionIdToRequest.java @@ -11,7 +11,6 @@ import javax.ws.rs.core.UriBuilder; import org.jclouds.cloudstack.domain.LoginResponse; import org.jclouds.http.HttpException; import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpRequestFilter; import com.google.common.base.Supplier; import com.google.common.net.HttpHeaders; @@ -23,7 +22,7 @@ import com.google.common.net.HttpHeaders; * /> */ @Singleton -public class AddSessionKeyAndJSessionIdToRequest implements HttpRequestFilter { +public class AddSessionKeyAndJSessionIdToRequest implements AuthenticationFilter { private final Supplier loginResponseSupplier; private final Provider uriBuilderProvider; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/AuthenticationFilter.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/AuthenticationFilter.java new file mode 100644 index 0000000000..369fc3ad26 --- /dev/null +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/AuthenticationFilter.java @@ -0,0 +1,35 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.cloudstack.filters; + +import org.jclouds.http.HttpRequestFilter; + +import com.google.inject.ImplementedBy; + +/** + * Marker interface that determines how we authenticate http requests in cloudstack. default to sign + * requests as opposed to login. + * + * @author Adrian Cole + * + */ +@ImplementedBy(QuerySigner.class) +public interface AuthenticationFilter extends HttpRequestFilter { + +} diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/QuerySigner.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/QuerySigner.java index 7789efdc91..c03a1e47e7 100644 --- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/QuerySigner.java +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/filters/QuerySigner.java @@ -58,7 +58,7 @@ import com.google.common.collect.Multimap; * */ @Singleton -public class QuerySigner implements HttpRequestFilter, RequestSigner { +public class QuerySigner implements AuthenticationFilter, RequestSigner { private final SignatureWire signatureWire; private final String accessKey; diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/LoginWithPasswordCredentials.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/LoginWithPasswordCredentials.java new file mode 100644 index 0000000000..1521c557ce --- /dev/null +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/functions/LoginWithPasswordCredentials.java @@ -0,0 +1,62 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.cloudstack.functions; + +import java.io.File; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.cloudstack.domain.LoginResponse; +import org.jclouds.cloudstack.features.SessionClient; +import org.jclouds.crypto.CryptoStreams; +import org.jclouds.domain.Credentials; + +import com.google.common.base.Function; + +@Singleton +public class LoginWithPasswordCredentials implements Function { + private final SessionClient client; + + @Inject + public LoginWithPasswordCredentials(SessionClient client) { + this.client = client; + } + + @Override + public LoginResponse apply(Credentials input) { + String username = input.identity; + String domain = "ROOT"; + // domain may be present + if (username.indexOf('/') != -1) { + File domainUsername = new File(username); + username = domainUsername.getName(); + domain = domainUsername.getParent(); + } + + String hashedPassword = CryptoStreams.md5Hex(input.credential); + + return client.loginUserInDomainWithHashOfPassword(username, domain, hashedPassword); + } + + @Override + public String toString() { + return "loginWithPasswordCredentials()"; + } +} \ No newline at end of file diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/RetryOnRenewAndLogoutOnClose.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/RetryOnRenewAndLogoutOnClose.java new file mode 100644 index 0000000000..1b3c0b07f5 --- /dev/null +++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/handlers/RetryOnRenewAndLogoutOnClose.java @@ -0,0 +1,92 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.cloudstack.handlers; + +import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream; +import static org.jclouds.http.HttpUtils.releasePayload; + +import javax.annotation.PreDestroy; +import javax.annotation.Resource; + +import org.jclouds.cloudstack.domain.LoginResponse; +import org.jclouds.cloudstack.features.SessionClient; +import org.jclouds.domain.Credentials; +import org.jclouds.http.HttpCommand; +import org.jclouds.http.HttpResponse; +import org.jclouds.http.HttpRetryHandler; +import org.jclouds.logging.Logger; + +import com.google.common.cache.LoadingCache; +import com.google.inject.Inject; +import com.google.inject.Singleton; + +/** + * This will parse and set an appropriate exception on the command object. + * + * @author Adrian Cole + * + */ +@Singleton +public class RetryOnRenewAndLogoutOnClose implements HttpRetryHandler { + @Resource + protected Logger logger = Logger.NULL; + + private final LoadingCache authenticationResponseCache; + private final SessionClient sessionClient; + + @Inject + protected RetryOnRenewAndLogoutOnClose(LoadingCache authenticationResponseCache, + SessionClient sessionClient) { + this.authenticationResponseCache = authenticationResponseCache; + this.sessionClient = sessionClient; + } + + @Override + public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { + boolean retry = false; // default + try { + switch (response.getStatusCode()) { + case 401: + byte[] content = closeClientButKeepContentStream(response); + if (new String(content).equals("TODO: What state can we retry?")) { + logger.debug("invalidating session"); + authenticationResponseCache.invalidateAll(); + retry = true; + } + } + return retry; + } finally { + releasePayload(response); + } + } + + /** + * it is important that we close any sessions on close to help the server not become overloaded. + */ + @PreDestroy + public void logoutOnClose() { + for (LoginResponse s : authenticationResponseCache.asMap().values()) { + try { + sessionClient.logoutUser(s.getSessionKey()); + } catch (Exception e) { + logger.error(e, "error logging out session %s", s.getSessionKey()); + } + } + } +} diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/PasswordAuthenticationExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/PasswordAuthenticationExpectTest.java new file mode 100644 index 0000000000..6f36a95d81 --- /dev/null +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/PasswordAuthenticationExpectTest.java @@ -0,0 +1,87 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.cloudstack; + +import static org.testng.Assert.assertNotNull; + +import java.net.URI; +import java.net.URLEncoder; +import java.util.Properties; + +import org.jclouds.cloudstack.features.AccountClient; +import org.jclouds.cloudstack.features.BaseCloudStackRestClientExpectTest; +import org.jclouds.http.HttpRequest; +import org.jclouds.http.HttpResponse; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableMultimap; +import com.google.common.net.HttpHeaders; + +/** + * + * @see KeystoneProperties#CREDENTIAL_TYPE + * @author Adrian Cole + */ +@Test(groups = "unit", testName = "PasswordAuthenticationExpectTest") +public class PasswordAuthenticationExpectTest extends BaseCloudStackRestClientExpectTest { + + /** + * this reflects the properties that a user would pass to createContext + */ + @Override + protected Properties setupProperties() { + Properties contextProperties = super.setupProperties(); + contextProperties.setProperty("jclouds.cloudstack.credential-type", "passwordCredentials"); + return contextProperties; + } + + + @SuppressWarnings("deprecation") + public void testLoginWithPasswordSetsSessionKeyAndCookie() { + + CloudStackContext context = requestsSendResponses( + loginRequest, loginResponse, + HttpRequest.builder() + .method("GET") + .endpoint( + URI.create("http://localhost:8080/client/api?response=json&command=listAccounts&sessionkey=" + URLEncoder.encode(sessionKey))) + .headers( + ImmutableMultimap.builder() + .put("Accept", "application/json") + .put(HttpHeaders.COOKIE, "JSESSIONID=" + jSessionId) + .build()) + .build(), + HttpResponse.builder() + .statusCode(200) + .payload(payloadFromResource("/listaccountsresponse.json")) + .build() + , logoutRequest, logoutResponse); + + AccountClient client = context.getProviderSpecificContext().getApi().getAccountClient(); + + assertNotNull(client.listAccounts()); + + context.close(); + } + + @Override + protected CloudStackContext clientFrom(CloudStackContext context) { + return context; + } +} diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/BaseCloudStackRestClientExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/BaseCloudStackRestClientExpectTest.java index 4f05a35a84..e8ffd55631 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/BaseCloudStackRestClientExpectTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/BaseCloudStackRestClientExpectTest.java @@ -18,6 +18,10 @@ */ package org.jclouds.cloudstack.features; +import static org.jclouds.crypto.CryptoStreams.md5Hex; + +import java.net.URI; +import java.net.URLEncoder; import java.util.Properties; import org.jclouds.cloudstack.CloudStackContext; @@ -28,6 +32,7 @@ import org.jclouds.logging.config.NullLoggingModule; import org.jclouds.rest.BaseRestClientExpectTest; import com.google.common.base.Function; +import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableSet; import com.google.inject.Module; @@ -51,4 +56,37 @@ public abstract class BaseCloudStackRestClientExpectTest extends BaseRestClie protected abstract S clientFrom(CloudStackContext context); + protected final HttpRequest loginRequest = HttpRequest.builder() + .method("GET") + .endpoint( + URI.create("http://localhost:8080/client/api?response=json&command=login&" + + "username=identity&password=" + md5Hex("credential")+ "&domain=ROOT")) + .headers( + ImmutableMultimap.builder() + .put("Accept", "application/json") + .build()) + .build(); + + protected final String jSessionId = "90DD65D13AEAA590ECCA312D150B9F6D"; + protected final String sessionKey = "uYT4/MNiglgAKiZRQkvV8QP8gn0="; + + protected final HttpResponse loginResponse = HttpResponse.builder() + .statusCode(200) + .headers( + ImmutableMultimap.builder() + .put("Set-Cookie", "JSESSIONID="+jSessionId+"; Path=/client") + .build()) + .payload(payloadFromResource("/loginresponse.json")) + .build(); + + @SuppressWarnings("deprecation") + protected final HttpRequest logoutRequest = HttpRequest.builder() + .method("GET") + .endpoint( + URI.create("http://localhost:8080/client/api?response=json&command=logout&" + + "sessionkey=" + URLEncoder.encode(sessionKey))) + .build(); + + protected final HttpResponse logoutResponse = HttpResponse.builder().statusCode(200).build(); + } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/handlers/RetryOnRenewAndLogoutOnCloseTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/handlers/RetryOnRenewAndLogoutOnCloseTest.java new file mode 100644 index 0000000000..36622d8448 --- /dev/null +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/handlers/RetryOnRenewAndLogoutOnCloseTest.java @@ -0,0 +1,65 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.cloudstack.handlers; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expectLastCall; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; +import static org.testng.Assert.assertTrue; + +import org.jclouds.cloudstack.domain.LoginResponse; +import org.jclouds.cloudstack.features.SessionClient; +import org.jclouds.domain.Credentials; +import org.jclouds.http.HttpCommand; +import org.jclouds.http.HttpResponse; +import org.jclouds.io.Payloads; +import org.testng.annotations.Test; + +import com.google.common.cache.LoadingCache; + +/** + * Tests behavior of {@code RetryOnRenewAndLogoutOnClose} handler + * + * @author grkvlt@apache.org + */ +@Test(groups = "unit", testName = "RetryOnRenewAndLogoutOnCloseTest") +public class RetryOnRenewAndLogoutOnCloseTest { + @SuppressWarnings("unchecked") + @Test + public void test401ShouldRetry() { + HttpCommand command = createMock(HttpCommand.class); + SessionClient sessionClient = createMock(SessionClient.class); + LoadingCache cache = createMock(LoadingCache.class); + + cache.invalidateAll(); + expectLastCall(); + + replay(cache, command); + + HttpResponse response = HttpResponse.builder().payload( + Payloads.newStringPayload("TODO: What state can we retry?")).statusCode(401).build(); + + RetryOnRenewAndLogoutOnClose retry = new RetryOnRenewAndLogoutOnClose(cache, sessionClient); + + assertTrue(retry.shouldRetryRequest(command, response)); + + verify(cache, command); + } +}