/** * Does one of the following: * 1) Sends a request token request, and returns an approval URL to the calling app. * 2) Sends an access token request to swap a request token for an access token, and then asks * for data from the service provider. * 3) Asks for data from the service provider. */ private HttpResponseBuilder attemptFetch() throws OAuthRequestException, OAuthProtocolException { if (needApproval()) { // This is section 6.1 of the OAuth spec. checkCanApprove(); fetchRequestToken(); // This is section 6.2 of the OAuth spec. buildClientApprovalState(); buildAznUrl(); // break out of the content fetching chain, we need permission from // the user to do this return new HttpResponseBuilder() .setHttpStatusCode(HttpResponse.SC_OK) .setStrictNoCache(); } else if (needAccessToken()) { // This is section 6.3 of the OAuth spec checkCanApprove(); exchangeRequestToken(); saveAccessToken(); buildClientAccessState(); } return fetchData(); }
/** * Does one of the following: * 1) Sends a request token request, and returns an approval URL to the calling app. * 2) Sends an access token request to swap a request token for an access token, and then asks * for data from the service provider. * 3) Asks for data from the service provider. */ private HttpResponseBuilder attemptFetch() throws OAuthRequestException, OAuthProtocolException { if (needApproval()) { // This is section 6.1 of the OAuth spec. checkCanApprove(); fetchRequestToken(); // This is section 6.2 of the OAuth spec. buildClientApprovalState(); buildAznUrl(); // break out of the content fetching chain, we need permission from // the user to do this return new HttpResponseBuilder() .setHttpStatusCode(HttpResponse.SC_OK) .setStrictNoCache(); } else if (needAccessToken()) { // This is section 6.3 of the OAuth spec checkCanApprove(); exchangeRequestToken(); saveAccessToken(); buildClientAccessState(); } return fetchData(); }
/** * Does one of the following: * 1) Sends a request token request, and returns an approval URL to the calling app. * 2) Sends an access token request to swap a request token for an access token, and then asks * for data from the service provider. * 3) Asks for data from the service provider. */ private HttpResponseBuilder attemptFetch() throws OAuthRequestException, OAuthProtocolException { if (needApproval()) { // This is section 6.1 of the OAuth spec. checkCanApprove(); fetchRequestToken(); // This is section 6.2 of the OAuth spec. buildClientApprovalState(); buildAznUrl(); // break out of the content fetching chain, we need permission from // the user to do this return new HttpResponseBuilder() .setHttpStatusCode(HttpResponse.SC_OK) .setStrictNoCache(); } else if (needAccessToken()) { // This is section 6.3 of the OAuth spec checkCanApprove(); exchangeRequestToken(); saveAccessToken(); buildClientAccessState(); } return fetchData(); }