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 2015/07/13 00:02:58 UTC
[10/47] jclouds-labs git commit: JCLOUDS-372: changing OAuth timeout
from MINUTES to SECONDS
JCLOUDS-372: changing OAuth timeout from MINUTES to SECONDS
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/7b800888
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/7b800888
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/7b800888
Branch: refs/heads/1.9.x
Commit: 7b8008881764da082179318dfa3842835b85e3f6
Parents: b740f60
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Nov 11 14:44:27 2013 +0000
Committer: Andrew Phillips <an...@apache.org>
Committed: Tue Nov 12 12:06:19 2013 +0100
----------------------------------------------------------------------
.../main/java/org/jclouds/oauth/v2/config/OAuthModule.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/7b800888/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java
----------------------------------------------------------------------
diff --git a/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java b/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java
index 11c33bf..cc99444 100644
--- a/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java
+++ b/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java
@@ -66,9 +66,12 @@ public class OAuthModule extends AbstractModule {
}
/**
- * Provides a cache for tokens. Cache is time based and expires after 59 minutes (the maximum time a token is
- * valid is 60 minutes)
+ * Provides a cache for tokens. Cache is time based and by default expires after 59 minutes
+ * (the maximum time a token is valid is 60 minutes).
+ * This cache and expiry period is system-wide and does not attend to per-instance expiry time
+ * (e.g. "expires_in" from Google Compute -- which is set to the standard 3600 seconds).
*/
+ // NB: If per-instance expiry time is required, significant refactoring will be needed.
@Provides
@Singleton
public LoadingCache<TokenRequest, Token> provideAccessCache(Function<TokenRequest, Token> getAccess,
@@ -78,7 +81,7 @@ public class OAuthModule extends AbstractModule {
// bit before the deadline to make sure there aren't session expiration exceptions
sessionIntervalInSeconds = sessionIntervalInSeconds > 30 ? sessionIntervalInSeconds - 30 :
sessionIntervalInSeconds;
- return CacheBuilder.newBuilder().expireAfterWrite(sessionIntervalInSeconds, TimeUnit.MINUTES).build(CacheLoader
+ return CacheBuilder.newBuilder().expireAfterWrite(sessionIntervalInSeconds, TimeUnit.SECONDS).build(CacheLoader
.from(getAccess));
}