/** * @return * true if the access token as expired according to the expiry date * provided when this class was created, false otherwise. Note that * this method will always return true if no expiry date was provided * (i.e. {@link #getExpiry()} is null) since the expiry time is unknown. */ public boolean isAccessTokenExpired() { if (getExpiry() != null) { return getExpiry().before(new Date()); } else { return true; } }
/** * @return * true if the access token as expired according to the expiry date * provided when this class was created, false otherwise. Note that * this method will always return true if no expiry date was provided * (i.e. {@link #getExpiry()} is null) since the expiry time is unknown. */ public boolean isAccessTokenExpired() { if (getExpiry() != null) { return getExpiry().before(new Date()); } else { return true; } }
@Override public String toString() { return this.getClass().getName() + " [accessToken=" + getAccessToken() + ", refreshToken=" + getRefreshToken() + ", expiry=" + getExpiry() + ", isExpired? " + isAccessTokenExpired() + "]"; }
@Override public String toString() { return this.getClass().getName() + " [accessToken=" + getAccessToken() + ", refreshToken=" + getRefreshToken() + ", expiry=" + getExpiry() + ", isExpired? " + isAccessTokenExpired() + "]"; }
private OAuth2Tokens refreshOAuth2Tokens() throws IOException { log.debug("Refreshing OAuth2 access token using refresh token: " + this.oauth2Tokens.getRefreshToken()); OAuth2Tokens newTokens = this.oauthUtils.refreshOAuth2AccessToken(this.oauth2Tokens); this.setOAuth2Tokens(newTokens); log.debug("Refreshed OAuth2 access token to " + newTokens.getAccessToken() + " with expiry at " + newTokens.getExpiry()); return newTokens; }
private OAuth2Tokens refreshOAuth2Tokens() throws IOException { log.debug("Refreshing OAuth2 access token using refresh token: " + this.oauth2Tokens.getRefreshToken()); OAuth2Tokens newTokens = this.oauthUtils.refreshOAuth2AccessToken(this.oauth2Tokens); this.setOAuth2Tokens(newTokens); log.debug("Refreshed OAuth2 access token to " + newTokens.getAccessToken() + " with expiry at " + newTokens.getExpiry()); return newTokens; }