private void refreshToken() throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Refreshing OAuth access token."); } makeRequest(true); if (LOG.isTraceEnabled()) { LOG.trace(token.toString()); } }
if (isRefresh && token.getRefreshToken() == null) { throw new CmisConnectionException("No refresh token!"); writer.write(IOUtils.encodeURL(token.getRefreshToken())); } else { writer.write("grant_type=authorization_code"); token = new Token(jsonAccessToken.toString(), (jsonRefreshToken == null ? null : jsonRefreshToken.toString()), expiresIn * 1000 + System.currentTimeMillis()); fireTokenListner(token);
if (isRefresh && token.getRefreshToken() == null) { throw new CmisConnectionException("No refresh token!"); writer.write(IOUtils.encodeURL(token.getRefreshToken())); } else { writer.write("grant_type=authorization_code"); token = new Token(jsonAccessToken.toString(), (jsonRefreshToken == null ? null : jsonRefreshToken.toString()), expiresIn * 1000 + System.currentTimeMillis()); fireTokenListner(token);
token = new Token(accessToken, refreshToken, expirationTimestamp); fireTokenListner(token);
token = new Token(accessToken, refreshToken, expirationTimestamp); fireTokenListner(token);
/** * Gets the access token. If no access token is present or the access token * is expired, a new token is requested. * * @return the access token */ protected String getAccessToken() { lock.writeLock().lock(); try { if (token.getAccessToken() == null) { if (token.getRefreshToken() == null) { requestToken(); } else { refreshToken(); } } else if (token.isExpired()) { refreshToken(); } return token.getAccessToken(); } catch (CmisConnectionException ce) { throw ce; } catch (Exception e) { throw new CmisConnectionException("Cannot get OAuth access token: " + e.getMessage(), e); } finally { lock.writeLock().unlock(); } }
/** * Gets the access token. If no access token is present or the access token * is expired, a new token is requested. * * @return the access token */ protected String getAccessToken() { lock.writeLock().lock(); try { if (token.getAccessToken() == null) { if (token.getRefreshToken() == null) { requestToken(); } else { refreshToken(); } } else if (token.isExpired()) { refreshToken(); } return token.getAccessToken(); } catch (CmisConnectionException ce) { throw ce; } catch (Exception e) { throw new CmisConnectionException("Cannot get OAuth access token: " + e.getMessage(), e); } finally { lock.writeLock().unlock(); } }
private void requestToken() throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Requesting new OAuth access token."); } makeRequest(false); if (LOG.isTraceEnabled()) { LOG.trace(token.toString()); } }
private void requestToken() throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Requesting new OAuth access token."); } makeRequest(false); if (LOG.isTraceEnabled()) { LOG.trace(token.toString()); } }
private void refreshToken() throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Refreshing OAuth access token."); } makeRequest(true); if (LOG.isTraceEnabled()) { LOG.trace(token.toString()); } }