From 02cf695dbc12969470096ef80c0781a7713b514a Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 13 Apr 2021 19:18:30 +0300 Subject: [PATCH 01/39] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-ning/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- scribejava-java8/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index db2978831..b117ac97f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.scribejava scribejava pom - 8.2.0 + 8.2.1-SNAPSHOT ScribeJava OAuth Library The best OAuth library out there https://github.com/scribejava/scribejava @@ -36,7 +36,7 @@ scm:git:git://github.com/scribejava/scribejava.git scm:git:git@github.com:scribejava/scribejava.git https://github.com/scribejava/scribejava - scribejava-8.2.0 + HEAD diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index e0ca099eb..ec3882485 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.0 + 8.2.1-SNAPSHOT ../pom.xml diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index 0730794bf..bb4dd0886 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.0 + 8.2.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index d1a174281..104b7926a 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.0 + 8.2.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index 45e2113c3..57b7f3960 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.0 + 8.2.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index 7048bbd16..558fb2bab 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.0 + 8.2.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index bdc15a132..97e28ded3 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.0 + 8.2.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index fcce1cd32..7b899aa14 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.0 + 8.2.1-SNAPSHOT ../pom.xml diff --git a/scribejava-java8/pom.xml b/scribejava-java8/pom.xml index 4e9a12186..0ec2162de 100644 --- a/scribejava-java8/pom.xml +++ b/scribejava-java8/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.0 + 8.2.1-SNAPSHOT ../pom.xml From 78aac50e3c50c8af65037bb28c8f6199596fe5d0 Mon Sep 17 00:00:00 2001 From: Maria Besfamilnaya Date: Sat, 17 Apr 2021 01:20:09 +0300 Subject: [PATCH 02/39] add Instagram API (https://www.instagram.com/) --- README.md | 1 + .../github/scribejava/apis/InstagramApi.java | 67 +++++++++++++ .../InstagramAccessTokenErrorResponse.java | 86 +++++++++++++++++ .../InstagramAccessTokenJsonExtractor.java | 59 ++++++++++++ .../apis/instagram/InstagramService.java | 80 ++++++++++++++++ .../apis/examples/InstagramExample.java | 95 +++++++++++++++++++ .../scribejava/core/oauth/OAuth20Service.java | 2 +- 7 files changed, 389 insertions(+), 1 deletion(-) create mode 100644 scribejava-apis/src/main/java/com/github/scribejava/apis/InstagramApi.java create mode 100644 scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java create mode 100644 scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenJsonExtractor.java create mode 100644 scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java create mode 100644 scribejava-apis/src/test/java/com/github/scribejava/apis/examples/InstagramExample.java diff --git a/README.md b/README.md index cfa482f90..a91a90860 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ ScribeJava support out-of-box several HTTP clients: * HeadHunter ХэдХантер (https://hh.ru/) [example](https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/HHExample.java) * HiOrg-Server (https://www.hiorg-server.de/) [example](https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/HiOrgServerExample.java) * Imgur (http://imgur.com/) [example](https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/ImgurExample.java) +* Instagram (https://www.instagram.com/) [example](https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/InstagramExample.java) * Kaixin 开心网 (http://www.kaixin001.com/) [example](https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/Kaixin20Example.java) * Kakao (https://kakao.com/) [example](https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/KakaoExample.java) * Keycloak (https://www.keycloak.org/) [example](https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/KeycloakExample.java) diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/InstagramApi.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/InstagramApi.java new file mode 100644 index 000000000..9d1aa8306 --- /dev/null +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/InstagramApi.java @@ -0,0 +1,67 @@ +package com.github.scribejava.apis; + +import java.io.OutputStream; +import com.github.scribejava.apis.instagram.InstagramAccessTokenJsonExtractor; +import com.github.scribejava.apis.instagram.InstagramService; +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.extractors.TokenExtractor; +import com.github.scribejava.core.httpclient.HttpClient; +import com.github.scribejava.core.httpclient.HttpClientConfig; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.model.Verb; +import com.github.scribejava.core.oauth.OAuth20Service; +import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; +import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; + +/** + * Instagram API + */ +public class InstagramApi extends DefaultApi20 { + + private static class InstanceHolder { + + private static final InstagramApi INSTANCE = new InstagramApi(); + } + + public static InstagramApi instance() { + return InstanceHolder.INSTANCE; + } + + @Override + public Verb getAccessTokenVerb() { + return Verb.POST; + } + + @Override + public String getAccessTokenEndpoint() { + return "https://api.instagram.com/oauth/access_token"; + } + + @Override + public String getRefreshTokenEndpoint() { + return "https://graph.instagram.com/refresh_access_token"; + } + + @Override + protected String getAuthorizationBaseUrl() { + return "https://api.instagram.com/oauth/authorize"; + } + + @Override + public TokenExtractor getAccessTokenExtractor() { + return InstagramAccessTokenJsonExtractor.instance(); + } + + @Override + public ClientAuthentication getClientAuthentication() { + return RequestBodyAuthenticationScheme.instance(); + } + + @Override + public OAuth20Service createService(String apiKey, String apiSecret, String callback, String defaultScope, + String responseType, OutputStream debugStream, String userAgent, HttpClientConfig httpClientConfig, + HttpClient httpClient) { + return new InstagramService(this, apiKey, apiSecret, callback, defaultScope, responseType, + debugStream, userAgent, httpClientConfig, httpClient); + } +} diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java new file mode 100644 index 000000000..38fd07c4d --- /dev/null +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java @@ -0,0 +1,86 @@ +package com.github.scribejava.apis.instagram; + +import java.io.IOException; +import java.util.Objects; +import com.github.scribejava.core.exceptions.OAuthException; +import com.github.scribejava.core.model.Response; + +/** + * non standard Instagram replace for + * {@link com.github.scribejava.core.model.OAuth2AccessTokenErrorResponse} + * + * examples:
+ * + * '{"error_type": "OAuthException", "code": 400, "error_message": "Missing required field client_id"}' + */ +public class InstagramAccessTokenErrorResponse extends OAuthException { + + private static final long serialVersionUID = -1277129766099856895L; + + private final String errorType; + private final int codeInt; + private final Response response; + + public InstagramAccessTokenErrorResponse(String errorType, int code, + String errorMessage, Response response) { + super(errorMessage); + this.errorType = errorType; + this.codeInt = code; + this.response = response; + } + + public String getErrorType() { + return errorType; + } + + public int getCodeInt() { + return codeInt; + } + + /** + * + * @return body of response + * @throws IOException IOException + * @deprecated use {@link #getResponse()} and then {@link Response#getBody()} + */ + @Deprecated + public String getRawResponse() throws IOException { + return response.getBody(); + } + + public Response getResponse() { + return response; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InstagramAccessTokenErrorResponse that = (InstagramAccessTokenErrorResponse) o; + return codeInt == that.codeInt && Objects.equals(errorType, that.errorType) + && Objects.equals(response, that.response); + } + + @Override + public int hashCode() { + int hash = 5; + hash = 83 * hash + Objects.hashCode(response); + hash = 83 * hash + Objects.hashCode(getMessage()); + hash = 83 * hash + Objects.hashCode(errorType); + hash = 83 * hash + Objects.hashCode(codeInt); + return hash; + } + + @Override + public String toString() { + return "InstagramAccessTokenErrorResponse{" + + "errorType='" + errorType + '\'' + + ", codeInt=" + codeInt + + ", response=" + response + + '}'; + } +} diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenJsonExtractor.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenJsonExtractor.java new file mode 100644 index 000000000..3cca4337f --- /dev/null +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenJsonExtractor.java @@ -0,0 +1,59 @@ +package com.github.scribejava.apis.instagram; + +import java.io.IOException; +import com.fasterxml.jackson.databind.JsonNode; +import com.github.scribejava.apis.facebook.FacebookAccessTokenJsonExtractor; +import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor; +import com.github.scribejava.core.model.Response; + +/** + * non standard Facebook Extractor + */ +public class InstagramAccessTokenJsonExtractor extends OAuth2AccessTokenJsonExtractor { + + protected InstagramAccessTokenJsonExtractor() { + } + + private static class InstanceHolder { + + private static final InstagramAccessTokenJsonExtractor INSTANCE = new InstagramAccessTokenJsonExtractor(); + } + + public static InstagramAccessTokenJsonExtractor instance() { + return InstanceHolder.INSTANCE; + } + + /** + * Non standard error message. Could be Instagram or Facebook specific. + * Usually Instagram type is used for getting access tokens. Facebook type is used for + * refreshing tokens. + * + * examples:
+ * + * Instagram specific: + * '{"error_type": "OAuthException", "code": 400, "error_message": "Missing required field client_id"}' + * + * Facebook specific: + * '{"error":{"message":"Error validating application. Invalid application + * ID.","type":"OAuthException","code":101,"fbtrace_id":"CvDR+X4WWIx"}}' + * + * @param response response + */ + @Override + public void generateError(Response response) throws IOException { + final JsonNode errorNode = OAuth2AccessTokenJsonExtractor.OBJECT_MAPPER + .readTree(response.getBody()); + JsonNode error = errorNode.get("error"); + if (error != null) { + FacebookAccessTokenJsonExtractor.instance().generateError(response); + } else { + throw new InstagramAccessTokenErrorResponse( + errorNode.get("error_type").asText(), + errorNode.get("code").asInt(), + errorNode.get("error_message").asText(), + response + ); + } + } + +} diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java new file mode 100644 index 000000000..c1814fb8d --- /dev/null +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java @@ -0,0 +1,80 @@ +package com.github.scribejava.apis.instagram; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.concurrent.ExecutionException; +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.httpclient.HttpClient; +import com.github.scribejava.core.httpclient.HttpClientConfig; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.model.OAuthConstants; +import com.github.scribejava.core.model.OAuthRequest; +import com.github.scribejava.core.model.Verb; +import com.github.scribejava.core.oauth.OAuth20Service; + +public class InstagramService extends OAuth20Service { + + private static final String LONG_LIVED_ACCESS_TOKEN_ENDPOINT = "https://graph.instagram.com/access_token"; + + public InstagramService(DefaultApi20 api, String apiKey, String apiSecret, String callback, + String defaultScope, String responseType, OutputStream debugStream, String userAgent, + HttpClientConfig httpClientConfig, HttpClient httpClient) { + super(api, apiKey, apiSecret, callback, defaultScope, responseType, debugStream, + userAgent, httpClientConfig, httpClient); + } + + /** + * Refresh a long-lived Instagram User Access Token that is at least 24 hours old but has not expired. + * Refreshed tokens are valid for 60 days from the date at which they are refreshed. + * + * @param accessToken long-lived access token + * @param scope (not used) + * @return refresh token request + */ + @Override + protected OAuthRequest createRefreshTokenRequest(String accessToken, String scope) { + if (accessToken == null || accessToken.isEmpty()) { + throw new IllegalArgumentException("The refreshToken cannot be null or empty"); + } + final OAuthRequest request = new OAuthRequest(Verb.GET, getApi().getRefreshTokenEndpoint()); + + request.addParameter(OAuthConstants.GRANT_TYPE, "ig_refresh_token"); + request.addParameter(OAuthConstants.ACCESS_TOKEN, accessToken); + + logRequestWithParams("refresh token", request); + + return request; + } + + /** + * Get long-lived access token. + * + * Initial accessToken is valid for 1 hour so one can get long-lived access token. + * Long-lived access token is valid for 60 days. + * + * @param accessToken short-lived access token + * @return long-lived access token with filled expireIn and refreshToken + */ + public OAuth2AccessToken getLongLivedAccessToken(OAuth2AccessToken accessToken) + throws InterruptedException, ExecutionException, IOException { + String shortLivedAccessToken = accessToken.getAccessToken(); + OAuthRequest request = createLongLivedAccessTokenRequest(shortLivedAccessToken); + return sendAccessTokenRequestSync(request); + } + + private OAuthRequest createLongLivedAccessTokenRequest(String shortLivedAccessToken) { + final OAuthRequest request = new OAuthRequest(Verb.GET, LONG_LIVED_ACCESS_TOKEN_ENDPOINT); + + getApi().getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); + + request.addParameter(OAuthConstants.GRANT_TYPE, "ig_exchange_token"); + request.addParameter(OAuthConstants.ACCESS_TOKEN, shortLivedAccessToken); + + if (isDebug()) { + log("created long-lived access token request with body params [%s], query string params [%s]", + request.getBodyParams().asFormUrlEncodedString(), + request.getQueryStringParams().asFormUrlEncodedString()); + } + return request; + } +} diff --git a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/InstagramExample.java b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/InstagramExample.java new file mode 100644 index 000000000..aa4c2c3cd --- /dev/null +++ b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/InstagramExample.java @@ -0,0 +1,95 @@ +package com.github.scribejava.apis.examples; + +import java.io.IOException; +import java.util.Random; +import java.util.Scanner; +import java.util.concurrent.ExecutionException; +import com.github.scribejava.apis.InstagramApi; +import com.github.scribejava.apis.instagram.InstagramService; +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.model.OAuthRequest; +import com.github.scribejava.core.model.Response; +import com.github.scribejava.core.model.Verb; +import com.github.scribejava.core.oauth.OAuth20Service; + +public class InstagramExample { + + private static final String NETWORK_NAME = "Instagram"; + private static final String PROTECTED_RESOURCE_URL = + "https://graph.instagram.com/me/media?fields=id,caption,media_type,media_url,username"; + + private InstagramExample() { + } + + @SuppressWarnings("PMD.SystemPrintln") + public static void main(String... args) throws IOException, InterruptedException, ExecutionException { + // Replace these with your client id and secret + final String clientId = "client-id"; + final String clientSecret = "client-secret"; + final String secretState = "secret" + new Random().nextInt(999_999); + final OAuth20Service service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope("user_profile,user_media") + .callback("http://example.com") + .build(InstagramApi.instance()); + + final Scanner in = new Scanner(System.in, "UTF-8"); + + System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ==="); + System.out.println(); + + // Obtain the Authorization URL + System.out.println("Fetching the Authorization URL..."); + final String authorizationUrl = service.getAuthorizationUrl(secretState); + System.out.println("Got the Authorization URL!"); + System.out.println("Now go and authorize ScribeJava here:"); + System.out.println(authorizationUrl); + System.out.println("And paste the authorization code here"); + System.out.print(">>"); + final String code = in.nextLine(); + System.out.println(); + + System.out.println("And paste the state from server here. We have set 'secretState'='" + secretState + "'."); + System.out.print(">>"); + final String value = in.nextLine(); + if (secretState.equals(value)) { + System.out.println("State value does match!"); + } else { + System.out.println("Ooops, state value does not match!"); + System.out.println("Expected = " + secretState); + System.out.println("Got = " + value); + System.out.println(); + } + + System.out.println("Trading the Authorization Code for an Access Token..."); + final OAuth2AccessToken accessToken = service.getAccessToken(code); + System.out.println("Got the Access Token!"); + System.out.println("(The raw response looks like this: " + accessToken.getRawResponse() + "')"); + System.out.println(); + + // Now let's go and ask for a protected resource! + System.out.println("Now we're going to access a protected resource..."); + final OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL); + service.signRequest(accessToken, request); + try (Response response = service.execute(request)) { + System.out.println("Got it! Lets see what we found..."); + System.out.println(); + System.out.println(response.getCode()); + System.out.println(response.getBody()); + } + System.out.println(); + System.out.println("Thats it man! Go and build something awesome with ScribeJava! :)"); + + InstagramService instagramService = (InstagramService) service; + System.out.println("Now let's exchange our short-lived token to long-lived access token..."); + OAuth2AccessToken longLivedAccessToken = instagramService.getLongLivedAccessToken(accessToken); + System.out.println("Got the Access Token!"); + System.out.println("(The access token raw response looks like this: " + longLivedAccessToken.getRawResponse() + "')"); + + System.out.println("Now it's time to refresh long-lived token..."); + OAuth2AccessToken refreshAccessToken = service.refreshAccessToken(longLivedAccessToken.getAccessToken()); + System.out.println("Got the refreshed Access Token!"); + System.out.println("(The refreshed access token raw response looks like this: " + refreshAccessToken.getRawResponse() + "')"); + } +} diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java b/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java index 4b4bb6adb..d7fa0a32c 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java @@ -657,7 +657,7 @@ public OAuth2AccessToken pollAccessTokenDeviceAuthorizationGrant(DeviceAuthoriza } } - private void logRequestWithParams(String requestDescription, OAuthRequest request) { + protected void logRequestWithParams(String requestDescription, OAuthRequest request) { if (isDebug()) { log("created " + requestDescription + " request with body params [%s], query string params [%s]", request.getBodyParams().asFormUrlEncodedString(), From 9c8e4c12df64fc15a9d7fb0335156e918977a39a Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Mon, 19 Apr 2021 11:13:49 +0300 Subject: [PATCH 03/39] * add Instagram (https://www.instagram.com/) API (thanks to https://github.com/faent) * add getErrorMessage method to FacebookAccessTokenErrorResponse. Should be used instead of general getMessage method from the parent Exception --- changelog | 5 + .../github/scribejava/apis/FacebookApi.java | 3 - .../github/scribejava/apis/InstagramApi.java | 26 ++-- .../FacebookAccessTokenErrorResponse.java | 64 +++----- .../InstagramAccessTokenErrorResponse.java | 80 +++++----- .../InstagramAccessTokenJsonExtractor.java | 34 ++-- .../apis/instagram/InstagramService.java | 146 ++++++++++-------- .../apis/polar/PolarOAuthService.java | 4 +- .../apis/examples/InstagramExample.java | 32 ++-- .../FacebookAccessTokenJsonExtractorTest.java | 2 +- .../DeviceAuthorizationJsonExtractor.java | 11 -- .../OAuth2AccessTokenJsonExtractor.java | 11 -- .../model/OAuth2AccessTokenErrorResponse.java | 39 +---- .../core/model/OAuthResponseException.java | 44 ++++++ 14 files changed, 237 insertions(+), 264 deletions(-) create mode 100644 scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthResponseException.java diff --git a/changelog b/changelog index ee6336655..1ea8f699e 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +[SNAPSHOT] + * add Instagram (https://www.instagram.com/) API (thanks to https://github.com/faent) + * add getErrorMessage method to FacebookAccessTokenErrorResponse. Should be used instead of general getMessage method + from the parent Exception + [8.2.0] * add ScopeBuilder to easily specify multiple scopes while requesting OAuth2.0 Access Tokens * make Base64 en/de-coding not dependent from java8 implementation (use three optional implementation diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/FacebookApi.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/FacebookApi.java index 9c3ee7a46..d688248d6 100644 --- a/scribejava-apis/src/main/java/com/github/scribejava/apis/FacebookApi.java +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/FacebookApi.java @@ -13,9 +13,6 @@ import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; -/** - * Facebook API - */ public class FacebookApi extends DefaultApi20 { private final String version; diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/InstagramApi.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/InstagramApi.java index 9d1aa8306..85e408113 100644 --- a/scribejava-apis/src/main/java/com/github/scribejava/apis/InstagramApi.java +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/InstagramApi.java @@ -8,16 +8,13 @@ import com.github.scribejava.core.httpclient.HttpClient; import com.github.scribejava.core.httpclient.HttpClientConfig; import com.github.scribejava.core.model.OAuth2AccessToken; -import com.github.scribejava.core.model.Verb; -import com.github.scribejava.core.oauth.OAuth20Service; import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; -/** - * Instagram API - */ public class InstagramApi extends DefaultApi20 { + public static final String LONG_LIVED_ACCESS_TOKEN_ENDPOINT = "https://graph.instagram.com/access_token"; + private static class InstanceHolder { private static final InstagramApi INSTANCE = new InstagramApi(); @@ -27,11 +24,6 @@ public static InstagramApi instance() { return InstanceHolder.INSTANCE; } - @Override - public Verb getAccessTokenVerb() { - return Verb.POST; - } - @Override public String getAccessTokenEndpoint() { return "https://api.instagram.com/oauth/access_token"; @@ -49,19 +41,19 @@ protected String getAuthorizationBaseUrl() { @Override public TokenExtractor getAccessTokenExtractor() { - return InstagramAccessTokenJsonExtractor.instance(); + return InstagramAccessTokenJsonExtractor.instance(); } @Override public ClientAuthentication getClientAuthentication() { - return RequestBodyAuthenticationScheme.instance(); + return RequestBodyAuthenticationScheme.instance(); } @Override - public OAuth20Service createService(String apiKey, String apiSecret, String callback, String defaultScope, - String responseType, OutputStream debugStream, String userAgent, HttpClientConfig httpClientConfig, - HttpClient httpClient) { - return new InstagramService(this, apiKey, apiSecret, callback, defaultScope, responseType, - debugStream, userAgent, httpClientConfig, httpClient); + public InstagramService createService(String apiKey, String apiSecret, String callback, String defaultScope, + String responseType, OutputStream debugStream, String userAgent, HttpClientConfig httpClientConfig, + HttpClient httpClient) { + return new InstagramService(this, apiKey, apiSecret, callback, defaultScope, responseType, debugStream, + userAgent, httpClientConfig, httpClient); } } diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/facebook/FacebookAccessTokenErrorResponse.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/facebook/FacebookAccessTokenErrorResponse.java index 36cc4a504..ea5053931 100644 --- a/scribejava-apis/src/main/java/com/github/scribejava/apis/facebook/FacebookAccessTokenErrorResponse.java +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/facebook/FacebookAccessTokenErrorResponse.java @@ -1,6 +1,6 @@ package com.github.scribejava.apis.facebook; -import com.github.scribejava.core.exceptions.OAuthException; +import com.github.scribejava.core.model.OAuthResponseException; import com.github.scribejava.core.model.Response; import java.io.IOException; import java.util.Objects; @@ -16,39 +16,27 @@ * '{"error":{"message":"Error validating application. Invalid application * ID.","type":"OAuthException","code":101,"fbtrace_id":"CvDR+X4WWIx"}}' */ -public class FacebookAccessTokenErrorResponse extends OAuthException { +public class FacebookAccessTokenErrorResponse extends OAuthResponseException { private static final long serialVersionUID = -1277129766099856895L; + private final String errorMessage; private final String type; private final int codeInt; private final String fbtraceId; - private final Response response; - public FacebookAccessTokenErrorResponse(String message, String type, int code, String fbtraceId, - Response response) { - super(message); + public FacebookAccessTokenErrorResponse(String errorMessage, String type, int code, String fbtraceId, + Response response) + throws IOException { + super(response); + this.errorMessage = errorMessage; this.type = type; this.codeInt = code; this.fbtraceId = fbtraceId; - this.response = response; } - /** - * - * @param message message - * @param type type - * @param code code - * @param fbtraceId fbtraceId - * @param rawResponse rawResponse - * @deprecated use {@link #FacebookAccessTokenErrorResponse(java.lang.String, java.lang.String, - * int, java.lang.String, com.github.scribejava.core.model.Response) - * } - */ - @Deprecated - public FacebookAccessTokenErrorResponse(String message, String type, int code, String fbtraceId, - String rawResponse) { - this(message, type, code, fbtraceId, new Response(-1, null, null, rawResponse)); + public String getErrorMessage() { + return errorMessage; } public String getType() { @@ -63,26 +51,10 @@ public String getFbtraceId() { return fbtraceId; } - /** - * - * @return body of response - * @throws IOException IOException - * @deprecated use {@link #getResponse()} and then {@link Response#getBody()} - */ - @Deprecated - public String getRawResponse() throws IOException { - return response.getBody(); - } - - public Response getResponse() { - return response; - } - @Override public int hashCode() { - int hash = 5; - hash = 83 * hash + Objects.hashCode(response); - hash = 83 * hash + Objects.hashCode(getMessage()); + int hash = super.hashCode(); + hash = 83 * hash + Objects.hashCode(errorMessage); hash = 83 * hash + Objects.hashCode(type); hash = 83 * hash + Objects.hashCode(codeInt); hash = 83 * hash + Objects.hashCode(fbtraceId); @@ -100,11 +72,13 @@ public boolean equals(Object obj) { if (getClass() != obj.getClass()) { return false; } - final FacebookAccessTokenErrorResponse other = (FacebookAccessTokenErrorResponse) obj; - if (!Objects.equals(response, other.getResponse())) { + if (!super.equals(obj)) { return false; } - if (!Objects.equals(getMessage(), other.getMessage())) { + + final FacebookAccessTokenErrorResponse other = (FacebookAccessTokenErrorResponse) obj; + + if (!Objects.equals(errorMessage, other.getErrorMessage())) { return false; } if (!Objects.equals(type, other.getType())) { @@ -119,7 +93,7 @@ public boolean equals(Object obj) { @Override public String toString() { return "FacebookAccessTokenErrorResponse{'type'='" + type + "', 'codeInt'='" + codeInt - + "', 'fbtraceId'='" + fbtraceId + "', 'response'='" + response - + "', 'message'='" + getMessage() + "'}"; + + "', 'fbtraceId'='" + fbtraceId + "', 'response'='" + getResponse() + + "', 'errorMessage'='" + errorMessage + "'}"; } } diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java index 38fd07c4d..90e8ef92a 100644 --- a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java @@ -1,31 +1,32 @@ package com.github.scribejava.apis.instagram; +import com.github.scribejava.core.model.OAuthResponseException; import java.io.IOException; import java.util.Objects; -import com.github.scribejava.core.exceptions.OAuthException; import com.github.scribejava.core.model.Response; /** - * non standard Instagram replace for - * {@link com.github.scribejava.core.model.OAuth2AccessTokenErrorResponse} + * non standard Instagram replace for {@link com.github.scribejava.core.model.OAuth2AccessTokenErrorResponse} * * examples:
* * '{"error_type": "OAuthException", "code": 400, "error_message": "Missing required field client_id"}' */ -public class InstagramAccessTokenErrorResponse extends OAuthException { +public class InstagramAccessTokenErrorResponse extends OAuthResponseException { - private static final long serialVersionUID = -1277129766099856895L; + private static final long serialVersionUID = -1277129706699856895L; private final String errorType; - private final int codeInt; + private final int code; + private final String errorMessage; private final Response response; - public InstagramAccessTokenErrorResponse(String errorType, int code, - String errorMessage, Response response) { - super(errorMessage); + public InstagramAccessTokenErrorResponse(String errorType, int code, String errorMessage, Response response) + throws IOException { + super(response); this.errorType = errorType; - this.codeInt = code; + this.code = code; + this.errorMessage = errorMessage; this.response = response; } @@ -33,54 +34,51 @@ public String getErrorType() { return errorType; } - public int getCodeInt() { - return codeInt; + public int getCode() { + return code; } - /** - * - * @return body of response - * @throws IOException IOException - * @deprecated use {@link #getResponse()} and then {@link Response#getBody()} - */ - @Deprecated - public String getRawResponse() throws IOException { - return response.getBody(); - } - - public Response getResponse() { - return response; + public String getErrorMessage() { + return errorMessage; } @Override - public boolean equals(Object o) { - if (this == o) { - return true; + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; } - if (o == null || getClass() != o.getClass()) { - return false; + if (!super.equals(obj)) { + return false; + } + + final InstagramAccessTokenErrorResponse that = (InstagramAccessTokenErrorResponse) obj; + if (!Objects.equals(errorMessage, that.getErrorMessage())) { + return false; } - InstagramAccessTokenErrorResponse that = (InstagramAccessTokenErrorResponse) o; - return codeInt == that.codeInt && Objects.equals(errorType, that.errorType) - && Objects.equals(response, that.response); + return code == that.code && Objects.equals(errorType, that.errorType) + && Objects.equals(response, that.response); } @Override public int hashCode() { - int hash = 5; + int hash = super.hashCode(); hash = 83 * hash + Objects.hashCode(response); - hash = 83 * hash + Objects.hashCode(getMessage()); + hash = 83 * hash + Objects.hashCode(errorMessage); hash = 83 * hash + Objects.hashCode(errorType); - hash = 83 * hash + Objects.hashCode(codeInt); + hash = 83 * hash + Objects.hashCode(code); return hash; } @Override public String toString() { - return "InstagramAccessTokenErrorResponse{" + - "errorType='" + errorType + '\'' + - ", codeInt=" + codeInt + - ", response=" + response + - '}'; + return "InstagramAccessTokenErrorResponse{" + + "errorType='" + errorType + + "', code=" + code + + "', errorMessage='" + errorMessage + + "', response=" + response + + '}'; } } diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenJsonExtractor.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenJsonExtractor.java index 3cca4337f..8f30b2e96 100644 --- a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenJsonExtractor.java +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenJsonExtractor.java @@ -7,7 +7,7 @@ import com.github.scribejava.core.model.Response; /** - * non standard Facebook Extractor + * non standard Instagram Extractor */ public class InstagramAccessTokenJsonExtractor extends OAuth2AccessTokenJsonExtractor { @@ -24,36 +24,32 @@ public static InstagramAccessTokenJsonExtractor instance() { } /** - * Non standard error message. Could be Instagram or Facebook specific. - * Usually Instagram type is used for getting access tokens. Facebook type is used for - * refreshing tokens. + * Non standard error message. Could be Instagram or Facebook specific. Usually Instagram type is used for getting + * access tokens. Facebook type is used for refreshing tokens. * * examples:
* - * Instagram specific: - * '{"error_type": "OAuthException", "code": 400, "error_message": "Missing required field client_id"}' + * Instagram specific: '{"error_type": "OAuthException", "code": 400, "error_message": "Missing required field + * client_id"}' * - * Facebook specific: - * '{"error":{"message":"Error validating application. Invalid application + * Facebook specific: '{"error":{"message":"Error validating application. Invalid application * ID.","type":"OAuthException","code":101,"fbtrace_id":"CvDR+X4WWIx"}}' * * @param response response */ @Override public void generateError(Response response) throws IOException { - final JsonNode errorNode = OAuth2AccessTokenJsonExtractor.OBJECT_MAPPER - .readTree(response.getBody()); - JsonNode error = errorNode.get("error"); + final JsonNode errorNode = OAuth2AccessTokenJsonExtractor.OBJECT_MAPPER.readTree(response.getBody()); + final JsonNode error = errorNode.get("error"); if (error != null) { - FacebookAccessTokenJsonExtractor.instance().generateError(response); + FacebookAccessTokenJsonExtractor.instance().generateError(response); } else { - throw new InstagramAccessTokenErrorResponse( - errorNode.get("error_type").asText(), - errorNode.get("code").asInt(), - errorNode.get("error_message").asText(), - response - ); + throw new InstagramAccessTokenErrorResponse( + errorNode.get("error_type").asText(), + errorNode.get("code").asInt(), + errorNode.get("error_message").asText(), + response + ); } } - } diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java index c1814fb8d..03f652867 100644 --- a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java @@ -1,80 +1,102 @@ package com.github.scribejava.apis.instagram; +import com.github.scribejava.apis.InstagramApi; import java.io.IOException; import java.io.OutputStream; import java.util.concurrent.ExecutionException; -import com.github.scribejava.core.builder.api.DefaultApi20; import com.github.scribejava.core.httpclient.HttpClient; import com.github.scribejava.core.httpclient.HttpClientConfig; import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.model.OAuthAsyncRequestCallback; import com.github.scribejava.core.model.OAuthConstants; import com.github.scribejava.core.model.OAuthRequest; import com.github.scribejava.core.model.Verb; import com.github.scribejava.core.oauth.OAuth20Service; +import java.util.concurrent.Future; public class InstagramService extends OAuth20Service { - private static final String LONG_LIVED_ACCESS_TOKEN_ENDPOINT = "https://graph.instagram.com/access_token"; - - public InstagramService(DefaultApi20 api, String apiKey, String apiSecret, String callback, - String defaultScope, String responseType, OutputStream debugStream, String userAgent, - HttpClientConfig httpClientConfig, HttpClient httpClient) { - super(api, apiKey, apiSecret, callback, defaultScope, responseType, debugStream, - userAgent, httpClientConfig, httpClient); - } - - /** - * Refresh a long-lived Instagram User Access Token that is at least 24 hours old but has not expired. - * Refreshed tokens are valid for 60 days from the date at which they are refreshed. - * - * @param accessToken long-lived access token - * @param scope (not used) - * @return refresh token request - */ - @Override - protected OAuthRequest createRefreshTokenRequest(String accessToken, String scope) { - if (accessToken == null || accessToken.isEmpty()) { - throw new IllegalArgumentException("The refreshToken cannot be null or empty"); + public InstagramService(InstagramApi api, String apiKey, String apiSecret, String callback, String defaultScope, + String responseType, OutputStream debugStream, String userAgent, HttpClientConfig httpClientConfig, + HttpClient httpClient) { + super(api, apiKey, apiSecret, callback, defaultScope, responseType, debugStream, userAgent, httpClientConfig, + httpClient); } - final OAuthRequest request = new OAuthRequest(Verb.GET, getApi().getRefreshTokenEndpoint()); - - request.addParameter(OAuthConstants.GRANT_TYPE, "ig_refresh_token"); - request.addParameter(OAuthConstants.ACCESS_TOKEN, accessToken); - - logRequestWithParams("refresh token", request); - - return request; - } - - /** - * Get long-lived access token. - * - * Initial accessToken is valid for 1 hour so one can get long-lived access token. - * Long-lived access token is valid for 60 days. - * - * @param accessToken short-lived access token - * @return long-lived access token with filled expireIn and refreshToken - */ - public OAuth2AccessToken getLongLivedAccessToken(OAuth2AccessToken accessToken) - throws InterruptedException, ExecutionException, IOException { - String shortLivedAccessToken = accessToken.getAccessToken(); - OAuthRequest request = createLongLivedAccessTokenRequest(shortLivedAccessToken); - return sendAccessTokenRequestSync(request); - } - - private OAuthRequest createLongLivedAccessTokenRequest(String shortLivedAccessToken) { - final OAuthRequest request = new OAuthRequest(Verb.GET, LONG_LIVED_ACCESS_TOKEN_ENDPOINT); - - getApi().getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); - - request.addParameter(OAuthConstants.GRANT_TYPE, "ig_exchange_token"); - request.addParameter(OAuthConstants.ACCESS_TOKEN, shortLivedAccessToken); - - if (isDebug()) { - log("created long-lived access token request with body params [%s], query string params [%s]", - request.getBodyParams().asFormUrlEncodedString(), - request.getQueryStringParams().asFormUrlEncodedString()); + + /** + * Refresh a long-lived Instagram User Access Token that is at least 24 hours old but has not expired. Refreshed + * tokens are valid for 60 days from the date at which they are refreshed. + * + * @param accessToken long-lived access token + * @param scope (not used) + * @return refresh token request + */ + @Override + protected OAuthRequest createRefreshTokenRequest(String accessToken, String scope) { + if (accessToken == null || accessToken.isEmpty()) { + throw new IllegalArgumentException("The accessToken cannot be null or empty"); + } + final OAuthRequest request = new OAuthRequest(Verb.GET, getApi().getRefreshTokenEndpoint()); + + request.addParameter(OAuthConstants.GRANT_TYPE, "ig_refresh_token"); + request.addParameter(OAuthConstants.ACCESS_TOKEN, accessToken); + + logRequestWithParams("refresh token", request); + + return request; + } + + public Future getLongLivedAccessTokenAsync(OAuth2AccessToken accessToken) { + return getLongLivedAccessToken(accessToken.getAccessToken(), null); + } + + public Future getLongLivedAccessTokenAsync(String shortLivedAccessToken) { + return getLongLivedAccessToken(shortLivedAccessToken, null); + } + + public Future getLongLivedAccessToken(String shortLivedAccessToken, + OAuthAsyncRequestCallback callback) { + return sendAccessTokenRequestAsync(createLongLivedAccessTokenRequest(shortLivedAccessToken), callback); + } + + public Future getLongLivedAccessToken(OAuth2AccessToken accessToken, + OAuthAsyncRequestCallback callback) { + return getLongLivedAccessToken(accessToken.getAccessToken(), callback); + } + + /** + * Get long-lived access token. + * + * Initial accessToken is valid for 1 hour so one can get long-lived access token. Long-lived access token is valid + * for 60 days. + * + * @param accessToken short-lived access token + * @return long-lived access token with filled expireIn and refreshToken + */ + public OAuth2AccessToken getLongLivedAccessToken(OAuth2AccessToken accessToken) + throws InterruptedException, ExecutionException, IOException { + return getLongLivedAccessToken(accessToken.getAccessToken()); + } + + public OAuth2AccessToken getLongLivedAccessToken(String shortLivedAccessToken) + throws InterruptedException, ExecutionException, IOException { + final OAuthRequest request = createLongLivedAccessTokenRequest(shortLivedAccessToken); + return sendAccessTokenRequestSync(request); + } + + private OAuthRequest createLongLivedAccessTokenRequest(String shortLivedAccessToken) { + final OAuthRequest request = new OAuthRequest(Verb.GET, InstagramApi.LONG_LIVED_ACCESS_TOKEN_ENDPOINT); + + getApi().getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); + + request.addParameter(OAuthConstants.GRANT_TYPE, "ig_exchange_token"); + request.addParameter(OAuthConstants.ACCESS_TOKEN, shortLivedAccessToken); + + if (isDebug()) { + log("created long-lived access token request with body params [%s], query string params [%s]", + request.getBodyParams().asFormUrlEncodedString(), + request.getQueryStringParams().asFormUrlEncodedString()); + } + return request; } - return request; - } } diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/polar/PolarOAuthService.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/polar/PolarOAuthService.java index e0b0af6f1..c016d6ac7 100644 --- a/scribejava-apis/src/main/java/com/github/scribejava/apis/polar/PolarOAuthService.java +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/polar/PolarOAuthService.java @@ -1,6 +1,6 @@ package com.github.scribejava.apis.polar; -import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.apis.PolarAPI; import com.github.scribejava.core.httpclient.HttpClient; import com.github.scribejava.core.httpclient.HttpClientConfig; import com.github.scribejava.core.model.OAuthConstants; @@ -13,7 +13,7 @@ public class PolarOAuthService extends OAuth20Service { - public PolarOAuthService(DefaultApi20 api, String apiKey, String apiSecret, String callback, String defaultScope, + public PolarOAuthService(PolarAPI api, String apiKey, String apiSecret, String callback, String defaultScope, String responseType, OutputStream debugStream, String userAgent, HttpClientConfig httpClientConfig, HttpClient httpClient) { super(api, apiKey, apiSecret, callback, defaultScope, responseType, debugStream, userAgent, httpClientConfig, diff --git a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/InstagramExample.java b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/InstagramExample.java index aa4c2c3cd..9694ba909 100644 --- a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/InstagramExample.java +++ b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/InstagramExample.java @@ -16,8 +16,8 @@ public class InstagramExample { private static final String NETWORK_NAME = "Instagram"; - private static final String PROTECTED_RESOURCE_URL = - "https://graph.instagram.com/me/media?fields=id,caption,media_type,media_url,username"; + private static final String PROTECTED_RESOURCE_URL + = "https://graph.instagram.com/me/media?fields=id,caption,media_type,media_url,username"; private InstagramExample() { } @@ -29,10 +29,10 @@ public static void main(String... args) throws IOException, InterruptedException final String clientSecret = "client-secret"; final String secretState = "secret" + new Random().nextInt(999_999); final OAuth20Service service = new ServiceBuilder(clientId) - .apiSecret(clientSecret) - .defaultScope("user_profile,user_media") - .callback("http://example.com") - .build(InstagramApi.instance()); + .apiSecret(clientSecret) + .defaultScope("user_profile,user_media") + .callback("http://example.com") + .build(InstagramApi.instance()); final Scanner in = new Scanner(System.in, "UTF-8"); @@ -81,15 +81,17 @@ public static void main(String... args) throws IOException, InterruptedException System.out.println(); System.out.println("Thats it man! Go and build something awesome with ScribeJava! :)"); - InstagramService instagramService = (InstagramService) service; - System.out.println("Now let's exchange our short-lived token to long-lived access token..."); - OAuth2AccessToken longLivedAccessToken = instagramService.getLongLivedAccessToken(accessToken); - System.out.println("Got the Access Token!"); - System.out.println("(The access token raw response looks like this: " + longLivedAccessToken.getRawResponse() + "')"); + final InstagramService instagramService = (InstagramService) service; + System.out.println("Now let's exchange our short-lived token to long-lived access token..."); + final OAuth2AccessToken longLivedAccessToken = instagramService.getLongLivedAccessToken(accessToken); + System.out.println("Got the Access Token!"); + System.out.println("(The access token raw response looks like this: " + longLivedAccessToken.getRawResponse() + + "')"); - System.out.println("Now it's time to refresh long-lived token..."); - OAuth2AccessToken refreshAccessToken = service.refreshAccessToken(longLivedAccessToken.getAccessToken()); - System.out.println("Got the refreshed Access Token!"); - System.out.println("(The refreshed access token raw response looks like this: " + refreshAccessToken.getRawResponse() + "')"); + System.out.println("Now it's time to refresh long-lived token..."); + final OAuth2AccessToken refreshAccessToken = service.refreshAccessToken(longLivedAccessToken.getAccessToken()); + System.out.println("Got the refreshed Access Token!"); + System.out.println("(The refreshed access token raw response looks like this: " + + refreshAccessToken.getRawResponse() + "')"); } } diff --git a/scribejava-apis/src/test/java/com/github/scribejava/apis/facebook/FacebookAccessTokenJsonExtractorTest.java b/scribejava-apis/src/test/java/com/github/scribejava/apis/facebook/FacebookAccessTokenJsonExtractorTest.java index 45b68353b..240f08b81 100644 --- a/scribejava-apis/src/test/java/com/github/scribejava/apis/facebook/FacebookAccessTokenJsonExtractorTest.java +++ b/scribejava-apis/src/test/java/com/github/scribejava/apis/facebook/FacebookAccessTokenJsonExtractorTest.java @@ -29,7 +29,7 @@ public void run() throws Throwable { } }); - assertEquals("This authorization code has been used.", fateR.getMessage()); + assertEquals("This authorization code has been used.", fateR.getErrorMessage()); assertEquals("OAuthException", fateR.getType()); assertEquals(100, fateR.getCodeInt()); assertEquals("DtxvtGRaxbB", fateR.getFbtraceId()); diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/extractors/DeviceAuthorizationJsonExtractor.java b/scribejava-core/src/main/java/com/github/scribejava/core/extractors/DeviceAuthorizationJsonExtractor.java index 0dc0ce931..5b4fa248b 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/extractors/DeviceAuthorizationJsonExtractor.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/extractors/DeviceAuthorizationJsonExtractor.java @@ -28,17 +28,6 @@ public DeviceAuthorization extract(Response response) throws IOException { return createDeviceAuthorization(response.getBody()); } - /** - * - * @param rawResponse rawResponse - * @throws java.io.IOException IOException - * @deprecated use {@link #generateError(com.github.scribejava.core.model.Response) } - */ - @Deprecated - public void generateError(String rawResponse) throws IOException { - generateError(new Response(-1, null, null, rawResponse)); - } - public void generateError(Response response) throws IOException { OAuth2AccessTokenJsonExtractor.instance().generateError(response); } diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/extractors/OAuth2AccessTokenJsonExtractor.java b/scribejava-core/src/main/java/com/github/scribejava/core/extractors/OAuth2AccessTokenJsonExtractor.java index 982c7e499..b9bfd6cba 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/extractors/OAuth2AccessTokenJsonExtractor.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/extractors/OAuth2AccessTokenJsonExtractor.java @@ -39,17 +39,6 @@ public OAuth2AccessToken extract(Response response) throws IOException { return createToken(body); } - /** - * - * @param rawResponse rawResponse - * @throws java.io.IOException IOException - * @deprecated use {@link #generateError(com.github.scribejava.core.model.Response) } - */ - @Deprecated - public void generateError(String rawResponse) throws IOException { - generateError(new Response(-1, null, null, rawResponse)); - } - /** * Related documentation: https://tools.ietf.org/html/rfc6749#section-5.2 * diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuth2AccessTokenErrorResponse.java b/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuth2AccessTokenErrorResponse.java index c64a3d005..5c4a65a19 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuth2AccessTokenErrorResponse.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuth2AccessTokenErrorResponse.java @@ -1,6 +1,5 @@ package com.github.scribejava.core.model; -import com.github.scribejava.core.exceptions.OAuthException; import com.github.scribejava.core.oauth2.OAuth2Error; import java.io.IOException; @@ -9,39 +8,20 @@ /** * Representing "5.2. Error Response" */ -public class OAuth2AccessTokenErrorResponse extends OAuthException { +public class OAuth2AccessTokenErrorResponse extends OAuthResponseException { private static final long serialVersionUID = 2309424849700276816L; private final OAuth2Error error; private final String errorDescription; private final URI errorUri; - private final Response response; public OAuth2AccessTokenErrorResponse(OAuth2Error error, String errorDescription, URI errorUri, Response rawResponse) throws IOException { - super(rawResponse.getBody()); + super(rawResponse); this.error = error; this.errorDescription = errorDescription; this.errorUri = errorUri; - this.response = rawResponse; - } - - /** - * - * @param error error - * @param errorDescription errorDescription - * @param errorUri errorUri - * @param rawResponse rawResponse - * @throws java.io.IOException IOException - * @deprecated use {@link #OAuth2AccessTokenErrorResponse(com.github.scribejava.core.oauth2.OAuth2Error, - * java.lang.String, java.net.URI, com.github.scribejava.core.model.Response) - * } - */ - @Deprecated - public OAuth2AccessTokenErrorResponse(OAuth2Error error, String errorDescription, URI errorUri, - String rawResponse) throws IOException { - this(error, errorDescription, errorUri, new Response(-1, null, null, rawResponse)); } public OAuth2Error getError() { @@ -56,19 +36,4 @@ public URI getErrorUri() { return errorUri; } - /** - * - * @return body of response - * @throws IOException IOException - * @deprecated use {@link #getResponse()} and then {@link Response#getBody()} - */ - @Deprecated - public String getRawResponse() throws IOException { - return response.getBody(); - } - - public Response getResponse() { - return response; - } - } diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthResponseException.java b/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthResponseException.java new file mode 100644 index 000000000..51b46960e --- /dev/null +++ b/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthResponseException.java @@ -0,0 +1,44 @@ +package com.github.scribejava.core.model; + +import com.github.scribejava.core.exceptions.OAuthException; +import java.io.IOException; +import java.util.Objects; + +public class OAuthResponseException extends OAuthException { + + private static final long serialVersionUID = 1309424849700276816L; + + private final Response response; + + public OAuthResponseException(Response rawResponse) throws IOException { + super(rawResponse.getBody()); + this.response = rawResponse; + } + + public Response getResponse() { + return response; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 29 * hash + Objects.hashCode(response); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final OAuthResponseException other = (OAuthResponseException) obj; + return Objects.equals(this.response, other.response); + } + +} From fac51a866c225f2dfa915f4d28770090d4d9545a Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Mon, 19 Apr 2021 13:19:50 +0300 Subject: [PATCH 04/39] reorder methods in OAuth20Service, group them, comment groups --- .../scribejava/core/oauth/OAuth20Service.java | 319 +++++++++--------- 1 file changed, 164 insertions(+), 155 deletions(-) diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java b/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java index d7fa0a32c..82052e351 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java @@ -40,6 +40,108 @@ public OAuth20Service(DefaultApi20 api, String apiKey, String apiSecret, String this.defaultScope = defaultScope; } + // ===== common OAuth methods ===== + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return VERSION; + } + + public void signRequest(String accessToken, OAuthRequest request) { + api.getBearerSignature().signRequest(accessToken, request); + } + + public void signRequest(OAuth2AccessToken accessToken, OAuthRequest request) { + signRequest(accessToken == null ? null : accessToken.getAccessToken(), request); + } + + /** + * Returns the URL where you should redirect your users to authenticate your application. + * + * @return the URL where you should redirect your users + */ + public String getAuthorizationUrl() { + return createAuthorizationUrlBuilder().build(); + } + + public String getAuthorizationUrl(String state) { + return createAuthorizationUrlBuilder() + .state(state) + .build(); + } + + /** + * Returns the URL where you should redirect your users to authenticate your application. + * + * @param additionalParams any additional GET params to add to the URL + * @return the URL where you should redirect your users + */ + public String getAuthorizationUrl(Map additionalParams) { + return createAuthorizationUrlBuilder() + .additionalParams(additionalParams) + .build(); + } + + public String getAuthorizationUrl(PKCE pkce) { + return createAuthorizationUrlBuilder() + .pkce(pkce) + .build(); + } + + public AuthorizationUrlBuilder createAuthorizationUrlBuilder() { + return new AuthorizationUrlBuilder(this); + } + + public DefaultApi20 getApi() { + return api; + } + + public OAuth2Authorization extractAuthorization(String redirectLocation) { + final OAuth2Authorization authorization = new OAuth2Authorization(); + int end = redirectLocation.indexOf('#'); + if (end == -1) { + end = redirectLocation.length(); + } + for (String param : redirectLocation.substring(redirectLocation.indexOf('?') + 1, end).split("&")) { + final String[] keyValue = param.split("="); + if (keyValue.length == 2) { + try { + switch (keyValue[0]) { + case "code": + authorization.setCode(URLDecoder.decode(keyValue[1], "UTF-8")); + break; + case "state": + authorization.setState(URLDecoder.decode(keyValue[1], "UTF-8")); + break; + default: //just ignore any other param; + } + } catch (UnsupportedEncodingException ueE) { + throw new IllegalStateException("jvm without UTF-8, really?", ueE); + } + } + } + return authorization; + } + + public String getResponseType() { + return responseType; + } + + public String getDefaultScope() { + return defaultScope; + } + + protected void logRequestWithParams(String requestDescription, OAuthRequest request) { + if (isDebug()) { + log("created " + requestDescription + " request with body params [%s], query string params [%s]", + request.getBodyParams().asFormUrlEncodedString(), + request.getQueryStringParams().asFormUrlEncodedString()); + } + } + + // ===== common AccessToken request methods ===== //protected to facilitate mocking protected OAuth2AccessToken sendAccessTokenRequestSync(OAuthRequest request) throws IOException, InterruptedException, ExecutionException { @@ -83,6 +185,41 @@ public OAuth2AccessToken convert(Response response) throws IOException { }); } + // ===== get AccessToken authorisation code flow methods ===== + protected OAuthRequest createAccessTokenRequest(AccessTokenRequestParams params) { + final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint()); + + api.getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); + + request.addParameter(OAuthConstants.CODE, params.getCode()); + final String callback = getCallback(); + if (callback != null) { + request.addParameter(OAuthConstants.REDIRECT_URI, callback); + } + final String scope = params.getScope(); + if (scope != null) { + request.addParameter(OAuthConstants.SCOPE, scope); + } else if (defaultScope != null) { + request.addParameter(OAuthConstants.SCOPE, defaultScope); + } + request.addParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.AUTHORIZATION_CODE); + + final String pkceCodeVerifier = params.getPkceCodeVerifier(); + if (pkceCodeVerifier != null) { + request.addParameter(PKCE.PKCE_CODE_VERIFIER_PARAM, pkceCodeVerifier); + } + + final Map extraParameters = params.getExtraParameters(); + if (extraParameters != null && !extraParameters.isEmpty()) { + for (Map.Entry extraParameter : extraParameters.entrySet()) { + request.addParameter(extraParameter.getKey(), extraParameter.getValue()); + } + } + + logRequestWithParams("access token", request); + return request; + } + public Future getAccessTokenAsync(String code) { return getAccessToken(AccessTokenRequestParams.create(code), null); } @@ -118,37 +255,26 @@ public Future getAccessToken(String code, return getAccessToken(AccessTokenRequestParams.create(code), callback); } - protected OAuthRequest createAccessTokenRequest(AccessTokenRequestParams params) { - final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint()); + // ===== refresh AccessToken methods ===== + protected OAuthRequest createRefreshTokenRequest(String refreshToken, String scope) { + if (refreshToken == null || refreshToken.isEmpty()) { + throw new IllegalArgumentException("The refreshToken cannot be null or empty"); + } + final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getRefreshTokenEndpoint()); api.getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); - request.addParameter(OAuthConstants.CODE, params.getCode()); - final String callback = getCallback(); - if (callback != null) { - request.addParameter(OAuthConstants.REDIRECT_URI, callback); - } - final String scope = params.getScope(); if (scope != null) { request.addParameter(OAuthConstants.SCOPE, scope); } else if (defaultScope != null) { request.addParameter(OAuthConstants.SCOPE, defaultScope); } - request.addParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.AUTHORIZATION_CODE); - final String pkceCodeVerifier = params.getPkceCodeVerifier(); - if (pkceCodeVerifier != null) { - request.addParameter(PKCE.PKCE_CODE_VERIFIER_PARAM, pkceCodeVerifier); - } + request.addParameter(OAuthConstants.REFRESH_TOKEN, refreshToken); + request.addParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.REFRESH_TOKEN); - final Map extraParameters = params.getExtraParameters(); - if (extraParameters != null && !extraParameters.isEmpty()) { - for (Map.Entry extraParameter : extraParameters.entrySet()) { - request.addParameter(extraParameter.getKey(), extraParameter.getValue()); - } - } + logRequestWithParams("refresh token", request); - logRequestWithParams("access token", request); return request; } @@ -186,13 +312,11 @@ public Future refreshAccessToken(String refreshToken, String return sendAccessTokenRequestAsync(request, callback); } - protected OAuthRequest createRefreshTokenRequest(String refreshToken, String scope) { - if (refreshToken == null || refreshToken.isEmpty()) { - throw new IllegalArgumentException("The refreshToken cannot be null or empty"); - } - final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getRefreshTokenEndpoint()); - - api.getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); + // ===== get AccessToken password grant flow methods ===== + protected OAuthRequest createAccessTokenPasswordGrantRequest(String username, String password, String scope) { + final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint()); + request.addParameter(OAuthConstants.USERNAME, username); + request.addParameter(OAuthConstants.PASSWORD, password); if (scope != null) { request.addParameter(OAuthConstants.SCOPE, scope); @@ -200,10 +324,11 @@ protected OAuthRequest createRefreshTokenRequest(String refreshToken, String sco request.addParameter(OAuthConstants.SCOPE, defaultScope); } - request.addParameter(OAuthConstants.REFRESH_TOKEN, refreshToken); - request.addParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.REFRESH_TOKEN); + request.addParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.PASSWORD); - logRequestWithParams("refresh token", request); + api.getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); + + logRequestWithParams("access token password grant", request); return request; } @@ -253,22 +378,20 @@ public Future getAccessTokenPasswordGrantAsync(String usernam return sendAccessTokenRequestAsync(request, callback); } - protected OAuthRequest createAccessTokenPasswordGrantRequest(String username, String password, String scope) { + // ===== get AccessToken client credentials flow methods ===== + protected OAuthRequest createAccessTokenClientCredentialsGrantRequest(String scope) { final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint()); - request.addParameter(OAuthConstants.USERNAME, username); - request.addParameter(OAuthConstants.PASSWORD, password); + + api.getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); if (scope != null) { request.addParameter(OAuthConstants.SCOPE, scope); } else if (defaultScope != null) { request.addParameter(OAuthConstants.SCOPE, defaultScope); } + request.addParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.CLIENT_CREDENTIALS); - request.addParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.PASSWORD); - - api.getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); - - logRequestWithParams("access token password grant", request); + logRequestWithParams("access token client credentials grant", request); return request; } @@ -316,80 +439,7 @@ public Future getAccessTokenClientCredentialsGrant(String sco return sendAccessTokenRequestAsync(request, callback); } - protected OAuthRequest createAccessTokenClientCredentialsGrantRequest(String scope) { - final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint()); - - api.getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); - - if (scope != null) { - request.addParameter(OAuthConstants.SCOPE, scope); - } else if (defaultScope != null) { - request.addParameter(OAuthConstants.SCOPE, defaultScope); - } - request.addParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.CLIENT_CREDENTIALS); - - logRequestWithParams("access token client credentials grant", request); - - return request; - } - - /** - * {@inheritDoc} - */ - @Override - public String getVersion() { - return VERSION; - } - - public void signRequest(String accessToken, OAuthRequest request) { - api.getBearerSignature().signRequest(accessToken, request); - } - - public void signRequest(OAuth2AccessToken accessToken, OAuthRequest request) { - signRequest(accessToken == null ? null : accessToken.getAccessToken(), request); - } - - /** - * Returns the URL where you should redirect your users to authenticate your application. - * - * @return the URL where you should redirect your users - */ - public String getAuthorizationUrl() { - return createAuthorizationUrlBuilder().build(); - } - - public String getAuthorizationUrl(String state) { - return createAuthorizationUrlBuilder() - .state(state) - .build(); - } - - /** - * Returns the URL where you should redirect your users to authenticate your application. - * - * @param additionalParams any additional GET params to add to the URL - * @return the URL where you should redirect your users - */ - public String getAuthorizationUrl(Map additionalParams) { - return createAuthorizationUrlBuilder() - .additionalParams(additionalParams) - .build(); - } - - public String getAuthorizationUrl(PKCE pkce) { - return createAuthorizationUrlBuilder() - .pkce(pkce) - .build(); - } - - public AuthorizationUrlBuilder createAuthorizationUrlBuilder() { - return new AuthorizationUrlBuilder(this); - } - - public DefaultApi20 getApi() { - return api; - } - + // ===== revoke AccessToken methods ===== protected OAuthRequest createRevokeTokenRequest(String tokenToRevoke, TokenTypeHint tokenTypeHint) { final OAuthRequest request = new OAuthRequest(Verb.POST, api.getRevokeTokenEndpoint()); @@ -450,41 +500,7 @@ private void checkForErrorRevokeToken(Response response) throws IOException { } } - public OAuth2Authorization extractAuthorization(String redirectLocation) { - final OAuth2Authorization authorization = new OAuth2Authorization(); - int end = redirectLocation.indexOf('#'); - if (end == -1) { - end = redirectLocation.length(); - } - for (String param : redirectLocation.substring(redirectLocation.indexOf('?') + 1, end).split("&")) { - final String[] keyValue = param.split("="); - if (keyValue.length == 2) { - try { - switch (keyValue[0]) { - case "code": - authorization.setCode(URLDecoder.decode(keyValue[1], "UTF-8")); - break; - case "state": - authorization.setState(URLDecoder.decode(keyValue[1], "UTF-8")); - break; - default: //just ignore any other param; - } - } catch (UnsupportedEncodingException ueE) { - throw new IllegalStateException("jvm without UTF-8, really?", ueE); - } - } - } - return authorization; - } - - public String getResponseType() { - return responseType; - } - - public String getDefaultScope() { - return defaultScope; - } - + // ===== device Authorisation codes methods ===== protected OAuthRequest createDeviceAuthorizationCodesRequest(String scope) { final OAuthRequest request = new OAuthRequest(Verb.POST, api.getDeviceAuthorizationEndpoint()); request.addParameter(OAuthConstants.CLIENT_ID, getApiKey()); @@ -566,6 +582,7 @@ public Future getDeviceAuthorizationCodesAsync(String scope return getDeviceAuthorizationCodes(scope, null); } + // ===== get AccessToken Device Authorisation grant flow methods ===== protected OAuthRequest createAccessTokenDeviceAuthorizationGrantRequest(DeviceAuthorization deviceAuthorization) { final OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint()); request.addParameter(OAuthConstants.GRANT_TYPE, "urn:ietf:params:oauth:grant-type:device_code"); @@ -656,12 +673,4 @@ public OAuth2AccessToken pollAccessTokenDeviceAuthorizationGrant(DeviceAuthoriza Thread.sleep(intervalMillis); } } - - protected void logRequestWithParams(String requestDescription, OAuthRequest request) { - if (isDebug()) { - log("created " + requestDescription + " request with body params [%s], query string params [%s]", - request.getBodyParams().asFormUrlEncodedString(), - request.getQueryStringParams().asFormUrlEncodedString()); - } - } } From b6d5d8417eb57e52aab389858d19734dc09cd738 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Mon, 19 Apr 2021 14:13:48 +0300 Subject: [PATCH 05/39] prepare v8.3.0 --- README.md | 4 ++-- changelog | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a91a90860..27d3a3e32 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ You can pull ScribeJava from the central maven repository, just add these to you com.github.scribejava scribejava-apis - 8.2.0 + 8.3.0 ``` @@ -146,7 +146,7 @@ And in case you need just core classes (that's it, without any external API (FB, com.github.scribejava scribejava-core - 8.2.0 + 8.3.0 ``` diff --git a/changelog b/changelog index 1ea8f699e..b469257b6 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,4 @@ -[SNAPSHOT] +[8.3.0] * add Instagram (https://www.instagram.com/) API (thanks to https://github.com/faent) * add getErrorMessage method to FacebookAccessTokenErrorResponse. Should be used instead of general getMessage method from the parent Exception From 1e1571e56694872959222b5e0c78aee1d8910243 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Mon, 19 Apr 2021 14:15:06 +0300 Subject: [PATCH 06/39] [maven-release-plugin] prepare release scribejava-8.3.0 --- pom.xml | 4 ++-- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-ning/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- scribejava-java8/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index b117ac97f..054ef33bb 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.scribejava scribejava pom - 8.2.1-SNAPSHOT + 8.3.0 ScribeJava OAuth Library The best OAuth library out there https://github.com/scribejava/scribejava @@ -36,7 +36,7 @@ scm:git:git://github.com/scribejava/scribejava.git scm:git:git@github.com:scribejava/scribejava.git https://github.com/scribejava/scribejava - HEAD + scribejava-8.3.0 diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index ec3882485..a29509a4b 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.1-SNAPSHOT + 8.3.0 ../pom.xml diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index bb4dd0886..f49ec30fb 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.1-SNAPSHOT + 8.3.0 ../pom.xml diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index 104b7926a..706c46aed 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.1-SNAPSHOT + 8.3.0 ../pom.xml diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index 57b7f3960..4128374c1 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.1-SNAPSHOT + 8.3.0 ../pom.xml diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index 558fb2bab..4872949dd 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.1-SNAPSHOT + 8.3.0 ../pom.xml diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index 97e28ded3..a80cfa93f 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.1-SNAPSHOT + 8.3.0 ../pom.xml diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index 7b899aa14..88a4ade95 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.1-SNAPSHOT + 8.3.0 ../pom.xml diff --git a/scribejava-java8/pom.xml b/scribejava-java8/pom.xml index 0ec2162de..2df10aee0 100644 --- a/scribejava-java8/pom.xml +++ b/scribejava-java8/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.2.1-SNAPSHOT + 8.3.0 ../pom.xml From 0142ceb93648047256d57e0056554f161816c97d Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Mon, 19 Apr 2021 14:15:15 +0300 Subject: [PATCH 07/39] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-ning/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- scribejava-java8/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 054ef33bb..decaba8f8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.scribejava scribejava pom - 8.3.0 + 8.3.1-SNAPSHOT ScribeJava OAuth Library The best OAuth library out there https://github.com/scribejava/scribejava @@ -36,7 +36,7 @@ scm:git:git://github.com/scribejava/scribejava.git scm:git:git@github.com:scribejava/scribejava.git https://github.com/scribejava/scribejava - scribejava-8.3.0 + HEAD diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index a29509a4b..86bd17b0e 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.0 + 8.3.1-SNAPSHOT ../pom.xml diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index f49ec30fb..1bb47d717 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.0 + 8.3.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index 706c46aed..180e770f0 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.0 + 8.3.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index 4128374c1..5ade17de5 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.0 + 8.3.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index 4872949dd..87cd6c803 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.0 + 8.3.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index a80cfa93f..a92bd3ddb 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.0 + 8.3.1-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index 88a4ade95..61b64ea00 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.0 + 8.3.1-SNAPSHOT ../pom.xml diff --git a/scribejava-java8/pom.xml b/scribejava-java8/pom.xml index 2df10aee0..66f6d3928 100644 --- a/scribejava-java8/pom.xml +++ b/scribejava-java8/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.0 + 8.3.1-SNAPSHOT ../pom.xml From e10771853ab55641378415af7cd1582bad670f2c Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 11 May 2021 15:38:13 +0300 Subject: [PATCH 08/39] * fix java.lang.NoClassDefFoundError for non-java8 runtimes (e.g. Android 7.1.1) (thanks to https://github.com/ChristopherGittner) --- changelog | 4 ++++ .../core/base64/CommonsCodecBase64.java | 16 ++++++++++++---- .../scribejava/core/base64/Java8Base64.java | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/changelog b/changelog index b469257b6..c0d51f34d 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +[SNAPSHOT] + * fix java.lang.NoClassDefFoundError for non-java8 runtimes (e.g. Android 7.1.1) + (thanks to https://github.com/ChristopherGittner) + [8.3.0] * add Instagram (https://www.instagram.com/) API (thanks to https://github.com/faent) * add getErrorMessage method to FacebookAccessTokenErrorResponse. Should be used instead of general getMessage method diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/base64/CommonsCodecBase64.java b/scribejava-core/src/main/java/com/github/scribejava/core/base64/CommonsCodecBase64.java index 196a6c4f0..bb172d720 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/base64/CommonsCodecBase64.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/base64/CommonsCodecBase64.java @@ -2,10 +2,18 @@ public class CommonsCodecBase64 extends Base64 { - private static final org.apache.commons.codec.binary.Base64 BASE64_ENCODER - = new org.apache.commons.codec.binary.Base64(); - private static final org.apache.commons.codec.binary.Base64 BASE64_URL_ENCODER_WITHOUT_PADDING - = new org.apache.commons.codec.binary.Base64(0, null, true); + private static final org.apache.commons.codec.binary.Base64 BASE64_ENCODER; + private static final org.apache.commons.codec.binary.Base64 BASE64_URL_ENCODER_WITHOUT_PADDING; + + static { + if (isAvailable()) { + BASE64_ENCODER = new org.apache.commons.codec.binary.Base64(); + BASE64_URL_ENCODER_WITHOUT_PADDING = new org.apache.commons.codec.binary.Base64(0, null, true); + } else { + BASE64_ENCODER = null; + BASE64_URL_ENCODER_WITHOUT_PADDING = null; + } + } @Override protected String internalEncode(byte[] bytes) { diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/base64/Java8Base64.java b/scribejava-core/src/main/java/com/github/scribejava/core/base64/Java8Base64.java index a5cea8755..8e4c6c990 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/base64/Java8Base64.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/base64/Java8Base64.java @@ -3,7 +3,7 @@ public class Java8Base64 extends Base64 { private static final com.github.scribejava.java8.base64.Java8Base64 JAVA8_BASE64 - = new com.github.scribejava.java8.base64.Java8Base64(); + = isAvailable() ? new com.github.scribejava.java8.base64.Java8Base64() : null; @Override protected String internalEncode(byte[] bytes) { From 744a547b1123c97f8f580e5d3a90896c2599240b Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 11 May 2021 16:08:17 +0300 Subject: [PATCH 09/39] update deps --- pmd.xml | 5 +---- pom.xml | 6 +++--- scribejava-core/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pmd.xml b/pmd.xml index 7b5314710..5d93d340b 100644 --- a/pmd.xml +++ b/pmd.xml @@ -17,7 +17,6 @@ - @@ -34,8 +33,6 @@ - - @@ -48,6 +45,7 @@ + @@ -91,7 +89,6 @@ - diff --git a/pom.xml b/pom.xml index decaba8f8..812db228f 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ com.puppycrawl.tools checkstyle - 8.41.1 + 8.42 @@ -271,7 +271,7 @@ 7 - 6.33.0 + 6.34.0 @@ -288,7 +288,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.0.1 sign-artifacts diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index 1bb47d717..53ac49b1e 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -29,7 +29,7 @@ jakarta.xml.bind jakarta.xml.bind-api - 3.0.0 + 3.0.1 true diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index 87cd6c803..183841b3c 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -23,7 +23,7 @@ com.linecorp.armeria armeria - 1.6.0 + 1.7.2 com.github.scribejava From 82e0af898470f383196eece535275210c6c75d3d Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 11 May 2021 16:24:19 +0300 Subject: [PATCH 10/39] prepare v8.3.1 --- README.md | 4 ++-- changelog | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 27d3a3e32..ef4083367 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ You can pull ScribeJava from the central maven repository, just add these to you com.github.scribejava scribejava-apis - 8.3.0 + 8.3.1 ``` @@ -146,7 +146,7 @@ And in case you need just core classes (that's it, without any external API (FB, com.github.scribejava scribejava-core - 8.3.0 + 8.3.1 ``` diff --git a/changelog b/changelog index c0d51f34d..1b02de3ff 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,4 @@ -[SNAPSHOT] +[8.3.1] * fix java.lang.NoClassDefFoundError for non-java8 runtimes (e.g. Android 7.1.1) (thanks to https://github.com/ChristopherGittner) From b6fd7423cf2b7ee80f3ca1040d8c35986b657ed2 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 11 May 2021 16:25:50 +0300 Subject: [PATCH 11/39] [maven-release-plugin] prepare release scribejava-8.3.1 --- pom.xml | 4 ++-- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-ning/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- scribejava-java8/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 812db228f..205cb54ae 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.scribejava scribejava pom - 8.3.1-SNAPSHOT + 8.3.1 ScribeJava OAuth Library The best OAuth library out there https://github.com/scribejava/scribejava @@ -36,7 +36,7 @@ scm:git:git://github.com/scribejava/scribejava.git scm:git:git@github.com:scribejava/scribejava.git https://github.com/scribejava/scribejava - HEAD + scribejava-8.3.1 diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index 86bd17b0e..2c6af49f7 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1-SNAPSHOT + 8.3.1 ../pom.xml diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index 53ac49b1e..bcdd78d4f 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1-SNAPSHOT + 8.3.1 ../pom.xml diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index 180e770f0..6b9f3d588 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1-SNAPSHOT + 8.3.1 ../pom.xml diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index 5ade17de5..17f3886b7 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1-SNAPSHOT + 8.3.1 ../pom.xml diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index 183841b3c..8142c8f7a 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1-SNAPSHOT + 8.3.1 ../pom.xml diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index a92bd3ddb..1f782e777 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1-SNAPSHOT + 8.3.1 ../pom.xml diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index 61b64ea00..28f2de496 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1-SNAPSHOT + 8.3.1 ../pom.xml diff --git a/scribejava-java8/pom.xml b/scribejava-java8/pom.xml index 66f6d3928..5218f340f 100644 --- a/scribejava-java8/pom.xml +++ b/scribejava-java8/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1-SNAPSHOT + 8.3.1 ../pom.xml From 2706674ddfa7c08a6e4500d4b031bc4a5bd4ff87 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 11 May 2021 16:25:56 +0300 Subject: [PATCH 12/39] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-ning/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- scribejava-java8/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 205cb54ae..6d8a51983 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.scribejava scribejava pom - 8.3.1 + 8.3.2-SNAPSHOT ScribeJava OAuth Library The best OAuth library out there https://github.com/scribejava/scribejava @@ -36,7 +36,7 @@ scm:git:git://github.com/scribejava/scribejava.git scm:git:git@github.com:scribejava/scribejava.git https://github.com/scribejava/scribejava - scribejava-8.3.1 + HEAD diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index 2c6af49f7..a9566dce7 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1 + 8.3.2-SNAPSHOT ../pom.xml diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index bcdd78d4f..7b5414eba 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1 + 8.3.2-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index 6b9f3d588..fb6828ed5 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1 + 8.3.2-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index 17f3886b7..cb3f0ed72 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1 + 8.3.2-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index 8142c8f7a..f8d08eaf9 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1 + 8.3.2-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index 1f782e777..7aa41c3d0 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1 + 8.3.2-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index 28f2de496..dc6778772 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1 + 8.3.2-SNAPSHOT ../pom.xml diff --git a/scribejava-java8/pom.xml b/scribejava-java8/pom.xml index 5218f340f..d8e7c74bd 100644 --- a/scribejava-java8/pom.xml +++ b/scribejava-java8/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.1 + 8.3.2-SNAPSHOT ../pom.xml From 124745961e999ccede90e2348c6012f8d335eb8a Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 3 Aug 2021 11:48:35 +0300 Subject: [PATCH 13/39] Create FUNDING.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..cb518bff4 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: ['https://paypal.me/kullfar'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From 2ec12afcea7fcf298991b6a5cf38b02da11cc302 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Wed, 13 Apr 2022 10:53:53 +0300 Subject: [PATCH 14/39] Update donate.md add new link --- donate.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/donate.md b/donate.md index ee6a1a6e7..729221908 100644 --- a/donate.md +++ b/donate.md @@ -1,8 +1,12 @@ You can now help ScribeJava not only by Pull Requests. -You can use [https://paypal.me/kullfar](https://paypal.me/kullfar) directly +You can use [https://www.paypal.com/paypalme/algr453](https://www.paypal.com/paypalme/algr453) directly. -or try donation button from PayPal: [![Donate with PayPal button](https://www.paypalobjects.com/en_US/RU/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E3XAUM2ET2R3Y&source=url) +
Donation button for monthly donations or donations by card (VISA, MasterCard, etc) may not be working, but you can try... +...or try donation button from PayPal: [![Donate with PayPal button](https://www.paypalobjects.com/en_US/RU/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E3XAUM2ET2R3Y&source=url) + +or old link [https://paypal.me/kullfar](https://paypal.me/kullfar) +
Thanks in advance! From 95abfdfa149f504063439b705b8bc6fede62faf8 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Wed, 13 Apr 2022 11:01:45 +0300 Subject: [PATCH 15/39] Update donate.md remove collapse element. It doesn't work with images --- donate.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/donate.md b/donate.md index 729221908..4dcb6724d 100644 --- a/donate.md +++ b/donate.md @@ -2,11 +2,12 @@ You can now help ScribeJava not only by Pull Requests. You can use [https://www.paypal.com/paypalme/algr453](https://www.paypal.com/paypalme/algr453) directly. -
Donation button for monthly donations or donations by card (VISA, MasterCard, etc) may not be working, but you can try... -...or try donation button from PayPal: [![Donate with PayPal button](https://www.paypalobjects.com/en_US/RU/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E3XAUM2ET2R3Y&source=url) + +Donation button for monthly donations or donations by card (VISA, MasterCard, etc) may not be working, but you can try... + +donation button from PayPal: [![Donate with PayPal button](https://www.paypalobjects.com/en_US/RU/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E3XAUM2ET2R3Y&source=url) or old link [https://paypal.me/kullfar](https://paypal.me/kullfar) -
Thanks in advance! From ab666c1af946b197a1cfca14867a9c84636729af Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Wed, 13 Apr 2022 11:08:34 +0300 Subject: [PATCH 16/39] Update donate.md make image works in collapsible section --- donate.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/donate.md b/donate.md index 4dcb6724d..829e9a635 100644 --- a/donate.md +++ b/donate.md @@ -2,12 +2,12 @@ You can now help ScribeJava not only by Pull Requests. You can use [https://www.paypal.com/paypalme/algr453](https://www.paypal.com/paypalme/algr453) directly. +
Donation button for monthly donations or donations by card (VISA, MasterCard, etc) may not be working, but you can try... -Donation button for monthly donations or donations by card (VISA, MasterCard, etc) may not be working, but you can try... - -donation button from PayPal: [![Donate with PayPal button](https://www.paypalobjects.com/en_US/RU/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E3XAUM2ET2R3Y&source=url) +Donation button from PayPal: [![Donate with PayPal button](https://www.paypalobjects.com/en_US/RU/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E3XAUM2ET2R3Y&source=url) or old link [https://paypal.me/kullfar](https://paypal.me/kullfar) +
Thanks in advance! From 3a07d71f50b4f00bfda5fbae0eb765e612529ad9 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Wed, 13 Apr 2022 11:09:47 +0300 Subject: [PATCH 17/39] Update FUNDING.yml update paypal link --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index cb518bff4..0a2df9277 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username -custom: ['https://paypal.me/kullfar'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +custom: ['https://www.paypal.com/paypalme/algr453'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From 4d7a88e6eb86655a31a2e62a35f9801c8d90ea8b Mon Sep 17 00:00:00 2001 From: "David (javalin.io)" Date: Sat, 4 Jun 2022 11:56:51 +0200 Subject: [PATCH 18/39] [readme] Change variable naming in example This is a more common convention, which is also used in your own examples: https://github.com/scribejava/scribejava/blob/master/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/Google20Example.java#L27-L35 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ef4083367..cd8b818ce 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Who said OAuth/OAuth2 was difficult? Configuring ScribeJava is __so easy your grandma can do it__! check it out: ```java -OAuthService service = new ServiceBuilder(YOUR_API_KEY) - .apiSecret(YOUR_API_SECRET) +OAuthService service = new ServiceBuilder(YOUR_CLIENT_ID) + .apiSecret(YOUR_CLIENT_SECRET) .build(LinkedInApi20.instance()); ``` From 4dff94d322794d7f52503ebea4542d346113cc37 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Fri, 26 Aug 2022 12:36:27 +0300 Subject: [PATCH 19/39] fix javadoc to fix build under openJDK 18.0.2 --- .../com/github/scribejava/core/model/OAuth2AccessToken.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuth2AccessToken.java b/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuth2AccessToken.java index 00d5b1636..f02bc57c6 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuth2AccessToken.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuth2AccessToken.java @@ -5,11 +5,9 @@ /** * Represents an OAuth 2 Access token. - *

* http://tools.ietf.org/html/rfc6749#section-5.1 * * @see OAuth 2 Access Token Specification - *

*/ public class OAuth2AccessToken extends Token { From 1fc8d4c22fa03d9dea74b38f5a4fb9fd2c0a70eb Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Fri, 9 Sep 2022 10:49:07 +0300 Subject: [PATCH 20/39] disable ParenPad checkstyle rule due to the bug in the NetBeans (nb-javac) "try with resources formatting adding extra space" https://github.com/apache/netbeans/issues/3720 Let's make our life easier, just skip this check temporarily --- checkstyle.xml | 4 +++- .../com/github/scribejava/core/oauth/OAuth10aService.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/checkstyle.xml b/checkstyle.xml index c9b0fac9b..f7efbad65 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -96,7 +96,9 @@ - + diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth10aService.java b/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth10aService.java index 89fd279b1..f48308b2e 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth10aService.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth10aService.java @@ -39,7 +39,7 @@ public OAuth1RequestToken getRequestToken() throws IOException, InterruptedExcep final OAuthRequest request = prepareRequestTokenRequest(); log("sending request..."); - try (Response response = execute(request)) { + try ( Response response = execute(request)) { if (isDebug()) { final String body = response.getBody(); log("response status code: %s", response.getCode()); @@ -105,7 +105,7 @@ public OAuth1AccessToken getAccessToken(OAuth1RequestToken requestToken, String log("obtaining access token from %s", api.getAccessTokenEndpoint()); } final OAuthRequest request = prepareAccessTokenRequest(requestToken, oauthVerifier); - try (Response response = execute(request)) { + try ( Response response = execute(request)) { return api.getAccessTokenExtractor().extract(response); } } From 083b5f37b3d30e725f0b5962c5033a4a05ecf986 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Mon, 12 Sep 2022 13:17:09 +0300 Subject: [PATCH 21/39] mark Response as transient in Serializable classes and small fixes in javadocs --- .../apis/instagram/InstagramAccessTokenErrorResponse.java | 2 +- .../com/github/scribejava/apis/instagram/InstagramService.java | 3 +++ .../github/scribejava/core/httpclient/jdk/JDKHttpFuture.java | 2 ++ .../github/scribejava/core/model/OAuthResponseException.java | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java index 90e8ef92a..bae3454a2 100644 --- a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramAccessTokenErrorResponse.java @@ -19,7 +19,7 @@ public class InstagramAccessTokenErrorResponse extends OAuthResponseException { private final String errorType; private final int code; private final String errorMessage; - private final Response response; + private final transient Response response; public InstagramAccessTokenErrorResponse(String errorType, int code, String errorMessage, Response response) throws IOException { diff --git a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java index 03f652867..5de1f3782 100644 --- a/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java +++ b/scribejava-apis/src/main/java/com/github/scribejava/apis/instagram/InstagramService.java @@ -72,6 +72,9 @@ public Future getLongLivedAccessToken(OAuth2AccessToken acces * * @param accessToken short-lived access token * @return long-lived access token with filled expireIn and refreshToken + * @throws java.lang.InterruptedException + * @throws java.util.concurrent.ExecutionException + * @throws java.io.IOException */ public OAuth2AccessToken getLongLivedAccessToken(OAuth2AccessToken accessToken) throws InterruptedException, ExecutionException, IOException { diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/jdk/JDKHttpFuture.java b/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/jdk/JDKHttpFuture.java index 1922d3aef..c4443cc87 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/jdk/JDKHttpFuture.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/jdk/JDKHttpFuture.java @@ -8,6 +8,8 @@ /** * Fake Future. Just to have Future API for the default JDK Http client. It's NOT Async in any way. Just facade.
* That's it. Sync execution with Async methods. This class does NOT provide any async executions. + * + * @param */ public class JDKHttpFuture implements Future { diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthResponseException.java b/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthResponseException.java index 51b46960e..5b6da25cf 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthResponseException.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthResponseException.java @@ -8,7 +8,7 @@ public class OAuthResponseException extends OAuthException { private static final long serialVersionUID = 1309424849700276816L; - private final Response response; + private final transient Response response; public OAuthResponseException(Response rawResponse) throws IOException { super(rawResponse.getBody()); From 8496a4e5b9c91df9fead056d8b3989babdce147c Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 13 Sep 2022 12:44:22 +0300 Subject: [PATCH 22/39] use in tests slf4j-simple instead of nop --- scribejava-httpclient-ahc/pom.xml | 6 ++++++ scribejava-httpclient-armeria/pom.xml | 6 ++++++ scribejava-httpclient-ning/pom.xml | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index fb6828ed5..04c2f8b06 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -20,6 +20,12 @@ scribejava-core ${project.version}
+ + org.slf4j + slf4j-simple + 2.0.0 + test + org.asynchttpclient async-http-client diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index f8d08eaf9..fbd805576 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -20,6 +20,12 @@ scribejava-core ${project.version} + + org.slf4j + slf4j-simple + 2.0.0 + test + com.linecorp.armeria armeria diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index 7aa41c3d0..a9de86702 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -8,7 +8,7 @@ 8.3.2-SNAPSHOT ../pom.xml - + com.github.scribejava scribejava-httpclient-ning ScribeJava Ning Async Http Client support @@ -20,6 +20,12 @@ scribejava-core ${project.version} + + org.slf4j + slf4j-simple + 2.0.0 + test + com.ning async-http-client From 2d4ee532022c35f7f3630fb5675c3d5999b63976 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Wed, 14 Sep 2022 11:01:23 +0300 Subject: [PATCH 23/39] fix ERRORs in build log due to the bug in the maven javadoc plugin (just update it) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6d8a51983..f8983b172 100644 --- a/pom.xml +++ b/pom.xml @@ -184,7 +184,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.4.1 ${java.home}/bin/javadoc UTF-8 From 23e02ed605556dcc7ca9c3acccefb10c6c65c8f0 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Wed, 14 Sep 2022 11:06:36 +0300 Subject: [PATCH 24/39] add changelog record about changes in the current SNAPSHOT --- changelog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog b/changelog index 1b02de3ff..0be0ed4b2 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +[SNAPSHOT] + * minor fixes and enhances + * update dependencies + [8.3.1] * fix java.lang.NoClassDefFoundError for non-java8 runtimes (e.g. Android 7.1.1) (thanks to https://github.com/ChristopherGittner) From 197c6a780eafb176a0d6d8c641bad560016efeec Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Thu, 15 Sep 2022 10:03:08 +0300 Subject: [PATCH 25/39] Update jackson to fix security warning --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f8983b172..d4505581f 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ com.fasterxml.jackson.core jackson-databind - 2.12.3 + 2.13.4 junit From f8f9587bb87848e263c83a106819af97fd43d29b Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Fri, 16 Sep 2022 11:24:10 +0300 Subject: [PATCH 26/39] update dependencies --- pom.xml | 20 ++++++++++---------- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index d4505581f..b678ae06d 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ com.squareup.okhttp3 mockwebserver - 4.9.1 + 4.10.0 test @@ -76,7 +76,7 @@ org.apache.felix maven-bundle-plugin - 5.1.2 + 5.1.8 bundle-manifest @@ -90,7 +90,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.2.2 ${project.build.outputDirectory}/META-INF/MANIFEST.MF @@ -100,7 +100,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.1.2 + 3.2.0 com.puppycrawl.tools @@ -125,19 +125,19 @@ org.apache.maven.plugins maven-clean-plugin - 3.1.0 + 3.2.0 org.apache.maven.plugins maven-install-plugin - 2.5.2 + 3.0.1 maven-compiler-plugin - 3.8.1 + 3.10.1 UTF-8 ${java.release} @@ -149,7 +149,7 @@ maven-deploy-plugin - 2.8.2 + 3.0.0 default-deploy @@ -163,7 +163,7 @@ org.apache.maven.plugins maven-resources-plugin - 3.2.0 + 3.3.0 UTF-8 @@ -225,7 +225,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.14.0 + 3.16.0 net.sourceforge.pmd diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index cb3f0ed72..7e1ba089b 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -28,7 +28,7 @@ org.apache.httpcomponents httpasyncclient - 4.1.4 + 4.1.5 com.github.scribejava diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index fbd805576..97b28e17f 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -29,7 +29,7 @@ com.linecorp.armeria armeria - 1.7.2 + 1.18.0 com.github.scribejava diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index dc6778772..d80798116 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -23,7 +23,7 @@ com.squareup.okhttp3 okhttp - 4.9.1 + 4.10.0 com.github.scribejava From d30eb248b82a30cd8404c2bf20c13e6a4a3020d4 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Fri, 16 Sep 2022 11:55:12 +0300 Subject: [PATCH 27/39] move some tests from blocked Facebook to vk.com to simplify release testing --- ...le.java => VkontakteAsyncApacheExample.java} | 17 +++++++++-------- ...mple.java => VkontakteAsyncNingExample.java} | 17 +++++++++-------- .../VkontakteClientCredentialsGrantExample.java | 2 +- .../apis/examples/VkontakteExample.java | 4 ++-- .../examples/VkontakteExternalHttpExample.java | 6 +++--- 5 files changed, 24 insertions(+), 22 deletions(-) rename scribejava-apis/src/test/java/com/github/scribejava/apis/examples/{FacebookAsyncApacheExample.java => VkontakteAsyncApacheExample.java} (89%) rename scribejava-apis/src/test/java/com/github/scribejava/apis/examples/{FacebookAsyncNingExample.java => VkontakteAsyncNingExample.java} (90%) diff --git a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/FacebookAsyncApacheExample.java b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteAsyncApacheExample.java similarity index 89% rename from scribejava-apis/src/test/java/com/github/scribejava/apis/examples/FacebookAsyncApacheExample.java rename to scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteAsyncApacheExample.java index 29d8dba96..392348b2b 100644 --- a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/FacebookAsyncApacheExample.java +++ b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteAsyncApacheExample.java @@ -3,7 +3,7 @@ import java.util.Random; import java.util.Scanner; import java.util.concurrent.ExecutionException; -import com.github.scribejava.apis.FacebookApi; +import com.github.scribejava.apis.VkontakteApi; import com.github.scribejava.core.builder.ServiceBuilder; import com.github.scribejava.core.model.OAuth2AccessToken; import com.github.scribejava.core.model.OAuthRequest; @@ -13,12 +13,13 @@ import com.github.scribejava.httpclient.apache.ApacheHttpClientConfig; import java.io.IOException; -public class FacebookAsyncApacheExample { +public class VkontakteAsyncApacheExample { - private static final String NETWORK_NAME = "Facebook"; - private static final String PROTECTED_RESOURCE_URL = "https://graph.facebook.com/v3.2/me"; + private static final String NETWORK_NAME = "vk.com"; + private static final String PROTECTED_RESOURCE_URL = "https://api.vk.com/method/users.get?v=" + + VkontakteApi.VERSION; - private FacebookAsyncApacheExample() { + private VkontakteAsyncApacheExample() { } @SuppressWarnings("PMD.SystemPrintln") @@ -28,11 +29,11 @@ public static void main(String... args) throws InterruptedException, ExecutionEx final String clientSecret = "your client secret"; final String secretState = "secret" + new Random().nextInt(999_999); - try (OAuth20Service service = new ServiceBuilder(clientId) + try ( OAuth20Service service = new ServiceBuilder(clientId) .apiSecret(clientSecret) .callback("http://www.example.com/oauth_callback/") .httpClientConfig(ApacheHttpClientConfig.defaultConfig()) - .build(FacebookApi.instance())) { + .build(VkontakteApi.instance())) { final Scanner in = new Scanner(System.in, "UTF-8"); System.out.println("=== " + NETWORK_NAME + "'s Async OAuth Workflow ==="); @@ -73,7 +74,7 @@ public static void main(String... args) throws InterruptedException, ExecutionEx System.out.println("Now we're going to access a protected resource..."); final OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL); service.signRequest(accessToken, request); - try (Response response = service.execute(request)) { + try ( Response response = service.execute(request)) { System.out.println("Got it! Lets see what we found..."); System.out.println(); System.out.println(response.getCode()); diff --git a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/FacebookAsyncNingExample.java b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteAsyncNingExample.java similarity index 90% rename from scribejava-apis/src/test/java/com/github/scribejava/apis/examples/FacebookAsyncNingExample.java rename to scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteAsyncNingExample.java index 29c52cbad..bfb80d1a9 100644 --- a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/FacebookAsyncNingExample.java +++ b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteAsyncNingExample.java @@ -5,7 +5,7 @@ import java.util.Random; import java.util.Scanner; import java.util.concurrent.ExecutionException; -import com.github.scribejava.apis.FacebookApi; +import com.github.scribejava.apis.VkontakteApi; import com.github.scribejava.core.builder.ServiceBuilder; import com.github.scribejava.core.model.OAuth2AccessToken; import com.github.scribejava.core.model.OAuthRequest; @@ -14,12 +14,13 @@ import com.github.scribejava.core.oauth.OAuth20Service; import java.io.IOException; -public class FacebookAsyncNingExample { +public class VkontakteAsyncNingExample { - private static final String NETWORK_NAME = "Facebook"; - private static final String PROTECTED_RESOURCE_URL = "https://graph.facebook.com/v3.2/me"; + private static final String NETWORK_NAME = "vk.com"; + private static final String PROTECTED_RESOURCE_URL = "https://api.vk.com/method/users.get?v=" + + VkontakteApi.VERSION; - private FacebookAsyncNingExample() { + private VkontakteAsyncNingExample() { } @SuppressWarnings("PMD.SystemPrintln") @@ -36,11 +37,11 @@ public static void main(String... args) throws InterruptedException, ExecutionEx .setReadTimeout(1_000) .build()); - try (OAuth20Service service = new ServiceBuilder(clientId) + try ( OAuth20Service service = new ServiceBuilder(clientId) .apiSecret(clientSecret) .callback("http://www.example.com/oauth_callback/") .httpClientConfig(clientConfig) - .build(FacebookApi.instance())) { + .build(VkontakteApi.instance())) { final Scanner in = new Scanner(System.in, "UTF-8"); System.out.println("=== " + NETWORK_NAME + "'s Async OAuth Workflow ==="); @@ -81,7 +82,7 @@ public static void main(String... args) throws InterruptedException, ExecutionEx System.out.println("Now we're going to access a protected resource..."); final OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL); service.signRequest(accessToken, request); - try (Response response = service.execute(request)) { + try ( Response response = service.execute(request)) { System.out.println("Got it! Lets see what we found..."); System.out.println(); System.out.println(response.getCode()); diff --git a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteClientCredentialsGrantExample.java b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteClientCredentialsGrantExample.java index 2b6e2d4f7..3e4d2d363 100644 --- a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteClientCredentialsGrantExample.java +++ b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteClientCredentialsGrantExample.java @@ -9,7 +9,7 @@ public class VkontakteClientCredentialsGrantExample { - private static final String NETWORK_NAME = "Vkontakte.ru"; + private static final String NETWORK_NAME = "vk.com>"; private VkontakteClientCredentialsGrantExample() { } diff --git a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExample.java b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExample.java index baa4dae91..ca1a698bf 100644 --- a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExample.java +++ b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExample.java @@ -15,7 +15,7 @@ public class VkontakteExample { - private static final String NETWORK_NAME = "Vkontakte.ru"; + private static final String NETWORK_NAME = "vk.com"; private static final String PROTECTED_RESOURCE_URL = "https://api.vk.com/method/users.get?v=" + VkontakteApi.VERSION; @@ -66,7 +66,7 @@ public static void main(String... args) throws IOException, InterruptedException System.out.println("Now we're going to access a protected resource..."); final OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL); service.signRequest(accessToken, request); - try (Response response = service.execute(request)) { + try ( Response response = service.execute(request)) { System.out.println("Got it! Lets see what we found..."); System.out.println(); System.out.println(response.getCode()); diff --git a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExternalHttpExample.java b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExternalHttpExample.java index 7f9e0c969..fe5340294 100644 --- a/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExternalHttpExample.java +++ b/scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExternalHttpExample.java @@ -16,7 +16,7 @@ public class VkontakteExternalHttpExample { - private static final String NETWORK_NAME = "Vkontakte.ru"; + private static final String NETWORK_NAME = "vk.com"; private static final String PROTECTED_RESOURCE_URL = "https://api.vk.com/method/users.get?v=" + VkontakteApi.VERSION; @@ -37,7 +37,7 @@ public static void main(String... args) throws IOException, InterruptedException .setReadTimeout(1_000) .build(); //wrap it - try (DefaultAsyncHttpClient ahcHttpClient = new DefaultAsyncHttpClient(httpClientConfig)) { + try ( DefaultAsyncHttpClient ahcHttpClient = new DefaultAsyncHttpClient(httpClientConfig)) { //wrap it final AhcHttpClient wrappedAHCHttpClient = new AhcHttpClient(ahcHttpClient); @@ -74,7 +74,7 @@ public static void main(String... args) throws IOException, InterruptedException System.out.println("Now we're going to access a protected resource..."); final OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL); service.signRequest(accessToken, request); - try (Response response = service.execute(request)) { + try ( Response response = service.execute(request)) { System.out.println("Got it! Lets see what we found..."); System.out.println(); System.out.println(response.getCode()); From 12c6b05b2839414bdaab1c3a70d9bc2d305f751a Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Mon, 19 Sep 2022 19:12:18 +0300 Subject: [PATCH 28/39] throw Throwable from callback (it got lost before) --- .../AbstractAsyncOnlyHttpClient.java | 75 ++++++++++++++++--- 1 file changed, 66 insertions(+), 9 deletions(-) diff --git a/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/AbstractAsyncOnlyHttpClient.java b/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/AbstractAsyncOnlyHttpClient.java index 48917eb60..10b3d5faa 100644 --- a/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/AbstractAsyncOnlyHttpClient.java +++ b/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/AbstractAsyncOnlyHttpClient.java @@ -1,6 +1,6 @@ package com.github.scribejava.core.httpclient; -import com.github.scribejava.core.model.OAuthRequest; +import com.github.scribejava.core.model.OAuthAsyncRequestCallback; import com.github.scribejava.core.model.Response; import com.github.scribejava.core.model.Verb; import java.io.File; @@ -14,8 +14,17 @@ public abstract class AbstractAsyncOnlyHttpClient implements HttpClient { public Response execute(String userAgent, Map headers, Verb httpVerb, String completeUrl, byte[] bodyContents) throws InterruptedException, ExecutionException, IOException { - return executeAsync(userAgent, headers, httpVerb, completeUrl, bodyContents, null, - (OAuthRequest.ResponseConverter) null).get(); + final OAuthAsyncRequestThrowableHolderCallback oAuthAsyncRequestThrowableHolderCallback + = new OAuthAsyncRequestThrowableHolderCallback(); + + final Response response = executeAsync(userAgent, headers, httpVerb, completeUrl, bodyContents, + oAuthAsyncRequestThrowableHolderCallback, null).get(); + + final Throwable throwable = oAuthAsyncRequestThrowableHolderCallback.getThrowable(); + if (throwable != null) { + throw new ExecutionException(throwable); + } + return response; } @Override @@ -23,23 +32,71 @@ public Response execute(String userAgent, Map headers, Verb http com.github.scribejava.core.httpclient.multipart.MultipartPayload bodyContents) throws InterruptedException, ExecutionException, IOException { - return executeAsync(userAgent, headers, httpVerb, completeUrl, bodyContents, null, - (OAuthRequest.ResponseConverter) null).get(); + final OAuthAsyncRequestThrowableHolderCallback oAuthAsyncRequestThrowableHolderCallback + = new OAuthAsyncRequestThrowableHolderCallback(); + + final Response response = executeAsync(userAgent, headers, httpVerb, completeUrl, bodyContents, + oAuthAsyncRequestThrowableHolderCallback, null).get(); + + final Throwable throwable = oAuthAsyncRequestThrowableHolderCallback.getThrowable(); + if (throwable != null) { + throw new ExecutionException(throwable); + } + + return response; } @Override public Response execute(String userAgent, Map headers, Verb httpVerb, String completeUrl, String bodyContents) throws InterruptedException, ExecutionException, IOException { - return executeAsync(userAgent, headers, httpVerb, completeUrl, bodyContents, null, - (OAuthRequest.ResponseConverter) null).get(); + final OAuthAsyncRequestThrowableHolderCallback oAuthAsyncRequestThrowableHolderCallback + = new OAuthAsyncRequestThrowableHolderCallback(); + + final Response response = executeAsync(userAgent, headers, httpVerb, completeUrl, bodyContents, + oAuthAsyncRequestThrowableHolderCallback, null).get(); + + final Throwable throwable = oAuthAsyncRequestThrowableHolderCallback.getThrowable(); + if (throwable != null) { + throw new ExecutionException(throwable); + } + + return response; } @Override public Response execute(String userAgent, Map headers, Verb httpVerb, String completeUrl, File bodyContents) throws InterruptedException, ExecutionException, IOException { - return executeAsync(userAgent, headers, httpVerb, completeUrl, bodyContents, null, - (OAuthRequest.ResponseConverter) null).get(); + final OAuthAsyncRequestThrowableHolderCallback oAuthAsyncRequestThrowableHolderCallback + = new OAuthAsyncRequestThrowableHolderCallback(); + + final Response response = executeAsync(userAgent, headers, httpVerb, completeUrl, bodyContents, + oAuthAsyncRequestThrowableHolderCallback, null).get(); + + final Throwable throwable = oAuthAsyncRequestThrowableHolderCallback.getThrowable(); + if (throwable != null) { + throw new ExecutionException(throwable); + } + + return response; + } + + private class OAuthAsyncRequestThrowableHolderCallback implements OAuthAsyncRequestCallback { + + private Throwable throwable; + + @Override + public void onCompleted(Response response) { + } + + @Override + public void onThrowable(Throwable t) { + throwable = t; + } + + public Throwable getThrowable() { + return throwable; + } } } From 23890ecc89b1b08e6475eccbd0d931a6fcfaf51e Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 20 Sep 2022 12:09:11 +0300 Subject: [PATCH 29/39] set netty version in tests to run armeria examples (it requires newer netty version, than one comes by default) --- scribejava-apis/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index a9566dce7..bf8298172 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -50,6 +50,12 @@ ${project.version} test + + io.netty + netty-resolver + 4.1.81.Final + test + From 0f05e63e4c5d1740ad7862d398394ca03645888e Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 20 Sep 2022 12:15:20 +0300 Subject: [PATCH 30/39] remove old unused exclude element from checkstyle's config --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index b678ae06d..5e940b98f 100644 --- a/pom.xml +++ b/pom.xml @@ -208,7 +208,6 @@ validate validate - main/java/com/github/scribejava/core/java8/* ${basedir}/src From 8cb3790de9ce117d19deb1ed000a536726b34472 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Fri, 7 Oct 2022 19:17:35 +0300 Subject: [PATCH 31/39] update github urls in pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5e940b98f..03fc143b8 100644 --- a/pom.xml +++ b/pom.xml @@ -33,8 +33,8 @@ - scm:git:git://github.com/scribejava/scribejava.git - scm:git:git@github.com:scribejava/scribejava.git + scm:git:https://github.com/scribejava/scribejava + scm:git:https://github.com/scribejava/scribejava https://github.com/scribejava/scribejava HEAD From bda9ac69301cb961d536c8b4b69bd35819894ffe Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Wed, 21 Sep 2022 11:55:42 +0300 Subject: [PATCH 32/39] prepare v8.3.2 --- README.md | 4 ++-- changelog | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ef4083367..cf827a808 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ You can pull ScribeJava from the central maven repository, just add these to you com.github.scribejava scribejava-apis - 8.3.1 + 8.3.2 ``` @@ -146,7 +146,7 @@ And in case you need just core classes (that's it, without any external API (FB, com.github.scribejava scribejava-core - 8.3.1 + 8.3.2 ``` diff --git a/changelog b/changelog index 0be0ed4b2..e50ae4ac6 100644 --- a/changelog +++ b/changelog @@ -1,6 +1,7 @@ -[SNAPSHOT] +[8.3.2] * minor fixes and enhances * update dependencies + * while using async HTTP client, you could miss some Throwables, now they will be thrown [8.3.1] * fix java.lang.NoClassDefFoundError for non-java8 runtimes (e.g. Android 7.1.1) From 466f37c6faf5a9a2de9c87ae1bce71b617a6185b Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Fri, 7 Oct 2022 19:23:18 +0300 Subject: [PATCH 33/39] [maven-release-plugin] prepare release scribejava-8.3.2 --- pom.xml | 4 ++-- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-ning/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- scribejava-java8/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 03fc143b8..fd271bdb0 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.scribejava scribejava pom - 8.3.2-SNAPSHOT + 8.3.2 ScribeJava OAuth Library The best OAuth library out there https://github.com/scribejava/scribejava @@ -36,7 +36,7 @@ scm:git:https://github.com/scribejava/scribejava scm:git:https://github.com/scribejava/scribejava https://github.com/scribejava/scribejava - HEAD + scribejava-8.3.2 diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index bf8298172..232195b0e 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2-SNAPSHOT + 8.3.2 ../pom.xml diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index 7b5414eba..95d8ba4a3 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2-SNAPSHOT + 8.3.2 ../pom.xml diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index 04c2f8b06..369a3a33b 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2-SNAPSHOT + 8.3.2 ../pom.xml diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index 7e1ba089b..45e805048 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2-SNAPSHOT + 8.3.2 ../pom.xml diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index 97b28e17f..ff8b9398b 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2-SNAPSHOT + 8.3.2 ../pom.xml diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index a9de86702..8eb71bf36 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2-SNAPSHOT + 8.3.2 ../pom.xml diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index d80798116..8ad92a707 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2-SNAPSHOT + 8.3.2 ../pom.xml diff --git a/scribejava-java8/pom.xml b/scribejava-java8/pom.xml index d8e7c74bd..edf1ddc95 100644 --- a/scribejava-java8/pom.xml +++ b/scribejava-java8/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2-SNAPSHOT + 8.3.2 ../pom.xml From fcd3f46ee27bac14984ce500cd6b344273eb0b09 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Fri, 7 Oct 2022 19:24:29 +0300 Subject: [PATCH 34/39] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-ning/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- scribejava-java8/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index fd271bdb0..cb7383ac8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.scribejava scribejava pom - 8.3.2 + 8.3.3-SNAPSHOT ScribeJava OAuth Library The best OAuth library out there https://github.com/scribejava/scribejava @@ -36,7 +36,7 @@ scm:git:https://github.com/scribejava/scribejava scm:git:https://github.com/scribejava/scribejava https://github.com/scribejava/scribejava - scribejava-8.3.2 + HEAD diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index 232195b0e..0162c0442 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2 + 8.3.3-SNAPSHOT ../pom.xml diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index 95d8ba4a3..a6a76e9b7 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2 + 8.3.3-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index 369a3a33b..69eeed503 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2 + 8.3.3-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index 45e805048..32fe5a3c8 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2 + 8.3.3-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index ff8b9398b..5906c70d1 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2 + 8.3.3-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index 8eb71bf36..7ae81ea08 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2 + 8.3.3-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index 8ad92a707..a8952a93b 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2 + 8.3.3-SNAPSHOT ../pom.xml diff --git a/scribejava-java8/pom.xml b/scribejava-java8/pom.xml index edf1ddc95..37a0c1388 100644 --- a/scribejava-java8/pom.xml +++ b/scribejava-java8/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.2 + 8.3.3-SNAPSHOT ../pom.xml From 77e0b8db7ae4f6337c2bb53d6c7d3f2e6805be9a Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 15 Nov 2022 17:32:04 +0300 Subject: [PATCH 35/39] update dependencies, including security updates in libraries --- changelog | 3 +++ pom.xml | 10 +++++----- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 4 ++-- scribejava-httpclient-ning/pom.xml | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/changelog b/changelog index e50ae4ac6..468003681 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +[SNAPSHOT] + * update dependencies, including security updates in libraries + [8.3.2] * minor fixes and enhances * update dependencies diff --git a/pom.xml b/pom.xml index cb7383ac8..64476229a 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4 + 2.14.0 junit @@ -90,7 +90,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.2 + 3.3.0 ${project.build.outputDirectory}/META-INF/MANIFEST.MF @@ -105,7 +105,7 @@ com.puppycrawl.tools checkstyle - 8.42 + 10.4 @@ -224,7 +224,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.16.0 + 3.19.0 net.sourceforge.pmd @@ -270,7 +270,7 @@ 7 - 6.34.0 + 6.51.0 diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index 0162c0442..ed2530193 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -53,7 +53,7 @@ io.netty netty-resolver - 4.1.81.Final + 4.1.84.Final test diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index a6a76e9b7..429c424f7 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -29,7 +29,7 @@ jakarta.xml.bind jakarta.xml.bind-api - 3.0.1 + 4.0.0 true diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index 69eeed503..eaf6a40f5 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -23,7 +23,7 @@ org.slf4j slf4j-simple - 2.0.0 + 2.0.3 test diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index 5906c70d1..754531885 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -23,13 +23,13 @@ org.slf4j slf4j-simple - 2.0.0 + 2.0.3 test com.linecorp.armeria armeria - 1.18.0 + 1.20.2 com.github.scribejava diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index 7ae81ea08..d4a1de13f 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -23,7 +23,7 @@ org.slf4j slf4j-simple - 2.0.0 + 2.0.3 test From 763a959f7b05ba5b9d3dabb39c8cd6511299c419 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 15 Nov 2022 18:24:27 +0300 Subject: [PATCH 36/39] [maven-release-plugin] prepare release scribejava-8.3.3 --- pom.xml | 4 ++-- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-ning/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- scribejava-java8/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 64476229a..b438813a2 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.scribejava scribejava pom - 8.3.3-SNAPSHOT + 8.3.3 ScribeJava OAuth Library The best OAuth library out there https://github.com/scribejava/scribejava @@ -36,7 +36,7 @@ scm:git:https://github.com/scribejava/scribejava scm:git:https://github.com/scribejava/scribejava https://github.com/scribejava/scribejava - HEAD + scribejava-8.3.3 diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index ed2530193..e0899df6b 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3-SNAPSHOT + 8.3.3 ../pom.xml diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index 429c424f7..237d120c8 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3-SNAPSHOT + 8.3.3 ../pom.xml diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index eaf6a40f5..91bbdf24e 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3-SNAPSHOT + 8.3.3 ../pom.xml diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index 32fe5a3c8..bfe1b5efc 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3-SNAPSHOT + 8.3.3 ../pom.xml diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index 754531885..d01d73561 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3-SNAPSHOT + 8.3.3 ../pom.xml diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index d4a1de13f..303e8b45d 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3-SNAPSHOT + 8.3.3 ../pom.xml diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index a8952a93b..6c6ac6e60 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3-SNAPSHOT + 8.3.3 ../pom.xml diff --git a/scribejava-java8/pom.xml b/scribejava-java8/pom.xml index 37a0c1388..27da11d77 100644 --- a/scribejava-java8/pom.xml +++ b/scribejava-java8/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3-SNAPSHOT + 8.3.3 ../pom.xml From 314d431b10a6be586668a3e1e755545a5f6a28e2 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Tue, 15 Nov 2022 18:30:57 +0300 Subject: [PATCH 37/39] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- scribejava-apis/pom.xml | 2 +- scribejava-core/pom.xml | 2 +- scribejava-httpclient-ahc/pom.xml | 2 +- scribejava-httpclient-apache/pom.xml | 2 +- scribejava-httpclient-armeria/pom.xml | 2 +- scribejava-httpclient-ning/pom.xml | 2 +- scribejava-httpclient-okhttp/pom.xml | 2 +- scribejava-java8/pom.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index b438813a2..b484b6a71 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.scribejava scribejava pom - 8.3.3 + 8.3.4-SNAPSHOT ScribeJava OAuth Library The best OAuth library out there https://github.com/scribejava/scribejava @@ -36,7 +36,7 @@ scm:git:https://github.com/scribejava/scribejava scm:git:https://github.com/scribejava/scribejava https://github.com/scribejava/scribejava - scribejava-8.3.3 + HEAD diff --git a/scribejava-apis/pom.xml b/scribejava-apis/pom.xml index e0899df6b..4e51bb8b5 100644 --- a/scribejava-apis/pom.xml +++ b/scribejava-apis/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3 + 8.3.4-SNAPSHOT ../pom.xml diff --git a/scribejava-core/pom.xml b/scribejava-core/pom.xml index 237d120c8..d5fbfc488 100644 --- a/scribejava-core/pom.xml +++ b/scribejava-core/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3 + 8.3.4-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ahc/pom.xml b/scribejava-httpclient-ahc/pom.xml index 91bbdf24e..fabd225c3 100644 --- a/scribejava-httpclient-ahc/pom.xml +++ b/scribejava-httpclient-ahc/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3 + 8.3.4-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-apache/pom.xml b/scribejava-httpclient-apache/pom.xml index bfe1b5efc..1dc9dd53c 100644 --- a/scribejava-httpclient-apache/pom.xml +++ b/scribejava-httpclient-apache/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3 + 8.3.4-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-armeria/pom.xml b/scribejava-httpclient-armeria/pom.xml index d01d73561..54e58c619 100644 --- a/scribejava-httpclient-armeria/pom.xml +++ b/scribejava-httpclient-armeria/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3 + 8.3.4-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-ning/pom.xml b/scribejava-httpclient-ning/pom.xml index 303e8b45d..39696d698 100644 --- a/scribejava-httpclient-ning/pom.xml +++ b/scribejava-httpclient-ning/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3 + 8.3.4-SNAPSHOT ../pom.xml diff --git a/scribejava-httpclient-okhttp/pom.xml b/scribejava-httpclient-okhttp/pom.xml index 6c6ac6e60..59bc2bffc 100644 --- a/scribejava-httpclient-okhttp/pom.xml +++ b/scribejava-httpclient-okhttp/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3 + 8.3.4-SNAPSHOT ../pom.xml diff --git a/scribejava-java8/pom.xml b/scribejava-java8/pom.xml index 27da11d77..b75f6d2de 100644 --- a/scribejava-java8/pom.xml +++ b/scribejava-java8/pom.xml @@ -5,7 +5,7 @@ com.github.scribejava scribejava - 8.3.3 + 8.3.4-SNAPSHOT ../pom.xml From 9112e0b9c4eafc521299f68b1fda96b4f304c6e3 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Wed, 25 Jan 2023 19:24:36 +0300 Subject: [PATCH 38/39] update changelog and README.md to reflect already released v8.3.3 --- README.md | 4 ++-- changelog | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cf827a808..7abc0854a 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ You can pull ScribeJava from the central maven repository, just add these to you com.github.scribejava scribejava-apis - 8.3.2 + 8.3.3 ``` @@ -146,7 +146,7 @@ And in case you need just core classes (that's it, without any external API (FB, com.github.scribejava scribejava-core - 8.3.2 + 8.3.3 ``` diff --git a/changelog b/changelog index 468003681..e962e073b 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,4 @@ -[SNAPSHOT] +[8.3.3] * update dependencies, including security updates in libraries [8.3.2] From 8970e8eeb0aff840d0b223890e9c392ee19218f7 Mon Sep 17 00:00:00 2001 From: Stanislav Gromov Date: Fri, 23 Feb 2024 16:11:39 +0300 Subject: [PATCH 39/39] Update donate.md --- donate.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/donate.md b/donate.md index 829e9a635..99d3686dc 100644 --- a/donate.md +++ b/donate.md @@ -2,16 +2,9 @@ You can now help ScribeJava not only by Pull Requests. You can use [https://www.paypal.com/paypalme/algr453](https://www.paypal.com/paypalme/algr453) directly. -
Donation button for monthly donations or donations by card (VISA, MasterCard, etc) may not be working, but you can try... - -Donation button from PayPal: [![Donate with PayPal button](https://www.paypalobjects.com/en_US/RU/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=E3XAUM2ET2R3Y&source=url) - -or old link [https://paypal.me/kullfar](https://paypal.me/kullfar) -
- Thanks in advance! -ps.If you can't for any reason use above methods, let me know, we will find the way out. +ps.If you can't for any reason use above method, let me know, we will find the way out. Hall of fame "Donors" (in alphabetical order, if you don't want to be here, just put a note along with the donation):
1.Douglas Ross from USA