public OauthToken validateToken(String token) throws OauthClientException { try{ OauthToken oauthToken = bees.jsonPOJORequest(gcUrl+"/oauth/tokens/"+token,null,OauthToken.class,"GET"); if(oauthToken.isExpired()){ return null; } return oauthToken; }catch (IOException e){ logger.log(Level.WARNING, "Failed to get token details",e); return null; } }
public OauthToken validateToken(String token) throws OauthClientException { try{ OauthToken oauthToken = bees.jsonPOJORequest(gcUrl+"/oauth/tokens/"+token,null,OauthToken.class,"GET"); if(oauthToken.isExpired()){ return null; } return oauthToken; }catch (IOException e){ logger.log(Level.WARNING, "Failed to get token details",e); return null; } }
/** * Gets the cached token valid in the cache, or if it's stale return null. */ private OauthToken getFromCache(String p) throws ExecutionException { CachedToken cache = this.cache.get(p); if (cache.isHalfExpired()) return null; OauthToken t = cache.get(); if(t==null || t.isExpired()){ return t; } return t; }
@Override public OauthToken validateToken(String token) throws OauthClientException { try { if (token==null) return null; CachedToken cache = this.cache.get(token); OauthToken t = cache.get(); if(t==null || t.isExpired()){ return null; } return t; } catch (ExecutionException e) { // not unwrapping an exception to capture the call stack throw new OauthClientException(e); } } }