From c0a438b6718b5ec8a827e1cad2f13a5c0f4d7345 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Mon, 5 Aug 2013 21:37:51 -0700 Subject: [PATCH] Revert "A 401 error should result in re-authenticating for a new token" This reverts commit 7b0cd9be43a6035a71652bb5c9f3cd604e18eb9d. References JCLOUDS-231 --- .../openstack/keystone/v2_0/handlers/RetryOnRenew.java | 4 ++-- .../openstack/keystone/v2_0/handlers/RetryOnRenewTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java index 835e65e01b..d3584846e9 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java @@ -64,8 +64,8 @@ public class RetryOnRenew implements HttpRetryHandler { retry = false; } else { byte[] content = closeClientButKeepContentStream(response); - // Error when the session token expires: HTTP/1.1 401 Unauthorized, no body (or provider-specific response body) - if (content != null) { + //TODO: what is the error when the session token expires?? + if (content != null && new String(content).contains("lease renew")) { logger.debug("invalidating authentication token"); authenticationResponseCache.invalidateAll(); retry = true; diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenewTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenewTest.java index 87beb379f3..f15270106c 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenewTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenewTest.java @@ -53,7 +53,7 @@ public class RetryOnRenewTest { cache.invalidateAll(); expectLastCall(); - expect(response.getPayload()).andReturn(Payloads.newStringPayload("")).anyTimes(); + expect(response.getPayload()).andReturn(Payloads.newStringPayload("token expired, please renew")).anyTimes(); expect(response.getStatusCode()).andReturn(401).atLeastOnce(); replay(command);