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.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@1738407 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shi Jinghai
2016-04-10 05:59:25 +00:00
parent 8104342a53
commit 99d00a4ec0
3 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ Here are the steps for a quick start in OFBiz trunk:
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
@@ -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);
@@ -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();