svn commit: r1738442 - in /ofbiz/branches/release15.12: ./ specialpurpose/passport/README specialpurpose/passport/src/org/ofbiz/passport/event/GitHubEvents.java specialpurpose/passport/src/org/ofbiz/passport/event/LinkedInEvents.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1738442 - in /ofbiz/branches/release15.12: ./ specialpurpose/passport/README specialpurpose/passport/src/org/ofbiz/passport/event/GitHubEvents.java specialpurpose/passport/src/org/ofbiz/passport/event/LinkedInEvents.java

jleroux@apache.org
Author: jleroux
Date: Sun Apr 10 17:16:05 2016
New Revision: 1738442

URL: http://svn.apache.org/viewvc?rev=1738442&view=rev
Log:
"Applied fix from trunk for revision: 1738407"
------------------------------------------------------------------------
r1738407 | shijh | 2016-04-10 07:59:25 +0200 (dim. 10 avr. 2016) | 4 lignes

OFBIZ-6755 Update the passport component to use httpclient/core-4.4.1 instead of commons-httpclient-3.1

1. Changed Applications to OAuth applications in README Github section.
2. Corrected the uri build to make the Github and LinkedIn OAuth login work.
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release15.12/   (props changed)
    ofbiz/branches/release15.12/specialpurpose/passport/README
    ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/GitHubEvents.java
    ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/LinkedInEvents.java

Propchange: ofbiz/branches/release15.12/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Apr 10 17:16:05 2016
@@ -9,4 +9,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/trunk:1722712,1723007,1723248,1724402,1724411,1724566,1724689,1724763,1724916,1724918,1724925,1724930,1724940,1724943,1724946,1724951,1724957,1724975,1724978,1725006,1725217,1725257,1725561,1725574,1726388,1726486,1726493,1726828,1728398,1728411,1729005,1729078,1729609,1729809,1730035,1730456,1730735-1730736,1730747,1730758,1730882,1730889,1731382,1731396,1732454,1732570,1732721,1733951,1733956,1734246,1734269,1734276,1734912,1734918,1735021,1735244,1735385,1735398,1735569,1735731,1735734,1735750,1735753,1735756,1735759,1735773,1736083,1736087,1736272,1736434,1736628,1736851,1736854,1737156,1737440,1738235,1738303
+/ofbiz/trunk:1722712,1723007,1723248,1724402,1724411,1724566,1724689,1724763,1724916,1724918,1724925,1724930,1724940,1724943,1724946,1724951,1724957,1724975,1724978,1725006,1725217,1725257,1725561,1725574,1726388,1726486,1726493,1726828,1728398,1728411,1729005,1729078,1729609,1729809,1730035,1730456,1730735-1730736,1730747,1730758,1730882,1730889,1731382,1731396,1732454,1732570,1732721,1733951,1733956,1734246,1734269,1734276,1734912,1734918,1735021,1735244,1735385,1735398,1735569,1735731,1735734,1735750,1735753,1735756,1735759,1735773,1736083,1736087,1736272,1736434,1736628,1736851,1736854,1737156,1737440,1738235,1738303,1738407

Modified: ofbiz/branches/release15.12/specialpurpose/passport/README
URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/specialpurpose/passport/README?rev=1738442&r1=1738441&r2=1738442&view=diff
==============================================================================
--- ofbiz/branches/release15.12/specialpurpose/passport/README (original)
+++ ofbiz/branches/release15.12/specialpurpose/passport/README Sun Apr 10 17:16:05 2016
@@ -16,7 +16,7 @@ Here are the steps for a quick start in
 
 2. Login GitHub.
 
-3. Visit Settings->Applications->Developer applications, click "Register new application" button.
+3. Visit Settings->OAuth applications->Developer applications, click "Register new application" button.
 
 4. In "Register a new OAuth application", fill in your OFBiz website information. Here the
 Authorization callback URL: https://YourWebSiteOrInternetIp:8443/ecomseo/githubResponse

Modified: ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/GitHubEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/GitHubEvents.java?rev=1738442&r1=1738441&r2=1738442&view=diff
==============================================================================
--- ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/GitHubEvents.java (original)
+++ ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/GitHubEvents.java Sun Apr 10 17:16:05 2016
@@ -171,12 +171,13 @@ public class GitHubEvents {
         
         try {
             URI uri = new URIBuilder()
-                    .setHost(TokenEndpoint)
+                    .setScheme(TokenEndpoint.substring(0, TokenEndpoint.indexOf(":")))
+                    .setHost(TokenEndpoint.substring(TokenEndpoint.indexOf(":") + 3))
                     .setPath(TokenServiceUri)
                     .setParameter("client_id", clientId)
                     .setParameter("client_secret", secret)
                     .setParameter("code", authorizationCode)
-                    .setParameter("redirect_uri", URLEncoder.encode(returnURI, "UTF-8"))
+                    .setParameter("redirect_uri", returnURI)
                     .build();
             HttpPost postMethod = new HttpPost(uri);
             CloseableHttpClient jsonClient = HttpClients.custom().build();
@@ -188,7 +189,7 @@ public class GitHubEvents {
             // Debug.logInfo("GitHub get access token response code: " + postResponse.getStatusLine().getStatusCode(), module);
             // Debug.logInfo("GitHub get access token response content: " + responseString, module);
             if (postResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
-                // Debug.logInfo("Json Response from GitHub: " + responseString, module);
+                Debug.logInfo("Json Response from GitHub: " + responseString, module);
                 JSON jsonObject = JSON.from(responseString);
                 JSONToMap jsonMap = new JSONToMap();
                 Map<String, Object> userMap = jsonMap.convert(jsonObject);

Modified: ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/LinkedInEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/LinkedInEvents.java?rev=1738442&r1=1738441&r2=1738442&view=diff
==============================================================================
--- ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/LinkedInEvents.java (original)
+++ ofbiz/branches/release15.12/specialpurpose/passport/src/org/ofbiz/passport/event/LinkedInEvents.java Sun Apr 10 17:16:05 2016
@@ -171,13 +171,14 @@ public class LinkedInEvents {
         
         try {
             URI uri = new URIBuilder()
-                    .setHost(TokenEndpoint)
+                    .setScheme(TokenEndpoint.substring(0, TokenEndpoint.indexOf(":")))
+                    .setHost(TokenEndpoint.substring(TokenEndpoint.indexOf(":") + 3))
                     .setPath(TokenServiceUri)
                     .setParameter("client_id", clientId)
                     .setParameter("client_secret", secret)
                     .setParameter("grant_type", "authorization_code")
                     .setParameter("code", authorizationCode)
-                    .setParameter("redirect_uri", URLEncoder.encode(returnURI, "UTF-8"))
+                    .setParameter("redirect_uri", returnURI)
                     .build();
             HttpPost postMethod = new HttpPost(uri);
             CloseableHttpClient jsonClient = HttpClients.custom().build();