@ Override public String getToken ( ) { log . debug ( "DefaultTokenManager getToken()" ) ; if ( ! checkCache ( ) ) { retrieveToken ( ) ; } // retrieve from cache if ( token == null ) { token = retrieveTokenFromCache ( ) ; } // check if expired if ( hasTokenExpired ( token ) ) { token = retrieveTokenFromCache ( ) ; } // check if token should be refreshed. If a refreshtoken is not present, the token manager will call upon the original tokenprovider retrieve a fresh token if ( isTokenExpiring ( token ) && ! isAsyncInProgress ( ) ) { if ( null != token . getRefresh_token ( ) ) { this . asyncInProgress = true ; submitRefreshTask ( ) ; } else { retrieveToken ( ) ; token = retrieveTokenFromCache ( ) ; } } if ( token . getAccess_token ( ) != null && ! token . getAccess_token ( ) . isEmpty ( ) ) { return token . getAccess_token ( ) ; } else if ( token . getDelegated_refresh_token ( ) != null && ! token . getDelegated_refresh_token ( ) . isEmpty ( ) ) { return token . getDelegated_refresh_token ( ) ; } else if ( token . getIms_token ( ) != null && ! token . getIms_token ( ) . isEmpty ( ) ) { return token . getIms_token ( ) ; } else { return token . getUaa_token ( ) ; } }
Retrieve the access token String from the OAuth2 token object