From f2ff13fb59ce898ad899cf4eccf075a65ad39d5a Mon Sep 17 00:00:00 2001 From: Shi Jinghai Date: Tue, 30 Jun 2015 18:38:16 +0000 Subject: [PATCH] OFBIZ-6135 - Passport Component for OAuth2 The oauth2 login icons will appear in /ecomseo/checkLogin page if the seed data files are properly configured and imported into database. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@1688503 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 3 +- component-load.xml | 1 + .../webapp/ecommerce/customer/newcustomer.ftl | 4 +- .../webapp/ecomseo/WEB-INF/controller.xml | 1 + ecommerce/widget/CommonScreens.xml | 1 + passport/README | 4 + passport/build.xml | 51 ++ passport/config/PassportUiLabels.xml | 98 ++++ passport/config/gitHubAuth.properties | 24 + passport/config/linkedInAuth.properties | 24 + passport/data/OAuth2CommonSeedData.xml | 28 ++ passport/data/OAuth2GitHubSeedData.xml | 34 ++ passport/data/OAuth2LinkedInSeedData.xml | 36 ++ passport/entitydef/entitymodel.xml | 121 +++++ passport/ofbiz-component.xml | 35 ++ .../ofbiz/passport/event/GitHubEvents.java | 322 ++++++++++++ .../ofbiz/passport/event/LinkedInEvents.java | 326 ++++++++++++ .../passport/user/GitHubAuthenticator.java | 416 ++++++++++++++++ .../passport/user/GitHubUserGroupMapper.java | 72 +++ .../passport/user/LinkedInAuthenticator.java | 471 ++++++++++++++++++ .../user/LinkedInUserGroupMapper.java | 72 +++ .../org/ofbiz/passport/util/PassportUtil.java | 196 ++++++++ .../actions/login/getThirdPartyLogins.groovy | 53 ++ .../passport/WEB-INF/controller-passport.xml | 60 +++ passport/webapp/passport/images/alipay.png | Bin 0 -> 4412 bytes passport/webapp/passport/images/github.png | Bin 0 -> 2323 bytes passport/webapp/passport/images/linkedin.png | Bin 0 -> 3537 bytes passport/webapp/passport/images/paypal.png | Bin 0 -> 4718 bytes passport/webapp/passport/images/qq.png | Bin 0 -> 4802 bytes passport/webapp/passport/images/renren.png | Bin 0 -> 4284 bytes passport/webapp/passport/images/taobao.png | Bin 0 -> 5299 bytes passport/webapp/passport/images/weibo.png | Bin 0 -> 4726 bytes passport/webapp/passport/images/weixin.png | Bin 0 -> 4217 bytes .../passport/login/thirdPartyLogins.ftl | 29 ++ passport/widget/PassportScreens.xml | 42 ++ 35 files changed, 2521 insertions(+), 3 deletions(-) create mode 100644 passport/README create mode 100644 passport/build.xml create mode 100644 passport/config/PassportUiLabels.xml create mode 100644 passport/config/gitHubAuth.properties create mode 100644 passport/config/linkedInAuth.properties create mode 100644 passport/data/OAuth2CommonSeedData.xml create mode 100644 passport/data/OAuth2GitHubSeedData.xml create mode 100644 passport/data/OAuth2LinkedInSeedData.xml create mode 100644 passport/entitydef/entitymodel.xml create mode 100644 passport/ofbiz-component.xml create mode 100644 passport/src/org/ofbiz/passport/event/GitHubEvents.java create mode 100644 passport/src/org/ofbiz/passport/event/LinkedInEvents.java create mode 100644 passport/src/org/ofbiz/passport/user/GitHubAuthenticator.java create mode 100644 passport/src/org/ofbiz/passport/user/GitHubUserGroupMapper.java create mode 100644 passport/src/org/ofbiz/passport/user/LinkedInAuthenticator.java create mode 100644 passport/src/org/ofbiz/passport/user/LinkedInUserGroupMapper.java create mode 100644 passport/src/org/ofbiz/passport/util/PassportUtil.java create mode 100644 passport/webapp/passport/WEB-INF/actions/login/getThirdPartyLogins.groovy create mode 100644 passport/webapp/passport/WEB-INF/controller-passport.xml create mode 100644 passport/webapp/passport/images/alipay.png create mode 100644 passport/webapp/passport/images/github.png create mode 100644 passport/webapp/passport/images/linkedin.png create mode 100644 passport/webapp/passport/images/paypal.png create mode 100644 passport/webapp/passport/images/qq.png create mode 100644 passport/webapp/passport/images/renren.png create mode 100644 passport/webapp/passport/images/taobao.png create mode 100644 passport/webapp/passport/images/weibo.png create mode 100644 passport/webapp/passport/images/weixin.png create mode 100644 passport/webapp/passport/login/thirdPartyLogins.ftl create mode 100644 passport/widget/PassportScreens.xml diff --git a/build.xml b/build.xml index a106b35f5..81b475848 100644 --- a/build.xml +++ b/build.xml @@ -37,6 +37,7 @@ projectmgr/build.xml, scrum/build.xml, bi/build.xml, - webpos/build.xml + webpos/build.xml, + passport/build.xml "/> diff --git a/component-load.xml b/component-load.xml index caa4c939f..63cd0e35b 100644 --- a/component-load.xml +++ b/component-load.xml @@ -40,4 +40,5 @@ under the License. + diff --git a/ecommerce/webapp/ecommerce/customer/newcustomer.ftl b/ecommerce/webapp/ecommerce/customer/newcustomer.ftl index f6ceafe2c..9212bb92a 100644 --- a/ecommerce/webapp/ecommerce/customer/newcustomer.ftl +++ b/ecommerce/webapp/ecommerce/customer/newcustomer.ftl @@ -51,8 +51,8 @@ under the License. } } function hideShowUsaStates() { - var customerStateElement = document.getElementById('newuserform_stateProvinceGeoId'); - var customerCountryElement = document.getElementById('newuserform_countryGeoId'); + var customerStateElement = document.getElementById('newuserform_stateProvinceGeoId'); + var customerCountryElement = document.getElementById('newuserform_countryGeoId'); if (customerCountryElement.value == "USA" || customerCountryElement.value == "UMI") { customerStateElement.style.display = "block"; } else { diff --git a/ecommerce/webapp/ecomseo/WEB-INF/controller.xml b/ecommerce/webapp/ecomseo/WEB-INF/controller.xml index ba0824d15..f389a6a62 100644 --- a/ecommerce/webapp/ecomseo/WEB-INF/controller.xml +++ b/ecommerce/webapp/ecomseo/WEB-INF/controller.xml @@ -21,6 +21,7 @@ under the License. + OFBiz: eCommerce SEO Controller Configuration File diff --git a/ecommerce/widget/CommonScreens.xml b/ecommerce/widget/CommonScreens.xml index f9bfdd41b..8c943d72c 100644 --- a/ecommerce/widget/CommonScreens.xml +++ b/ecommerce/widget/CommonScreens.xml @@ -336,6 +336,7 @@ under the License. + diff --git a/passport/README b/passport/README new file mode 100644 index 000000000..8b028080b --- /dev/null +++ b/passport/README @@ -0,0 +1,4 @@ +OFBiz Passport Component + +To support users to login with a third party OAuth2 authentication such as Github, LinkedIn and etc. + diff --git a/passport/build.xml b/passport/build.xml new file mode 100644 index 000000000..e2c1eea9d --- /dev/null +++ b/passport/build.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/passport/config/PassportUiLabels.xml b/passport/config/PassportUiLabels.xml new file mode 100644 index 000000000..7db7db8a4 --- /dev/null +++ b/passport/config/PassportUiLabels.xml @@ -0,0 +1,98 @@ + + + + + + Passport Third Party Auth Application + 第三方认证应用程序 + + + Third Party Login + 第三方登录 + + + + + Failed to match the state parameter in LinkedIn response. Just try to login again. + 领英响应中的state参数不一致。重试登录即可。 + + + Error while redirecting to LinkedIn authorization URL. Please use other login method for now. + 转到领英认证网址时出错。请先使用其它登录方式。 + + + Error while redirecting to LinkedIn authorization URL: ${errorMessage} + 转到领英认证网址时出错:${errorMessage}。 + + + Failed to get LinkedIn authorization code.<br>Error: ${error}<br>Error description: ${error_description} + 获取领英授权码时出错。<br>错误: ${error}<br>错误描述: ${error_description} + + + Failed to get LinkedIn authorization code. + 获取领英授权码时出错。 + + + Failed to get LinkedIn configuration. Please check whether OAuth2LinkedIn entity has your productStoreId configured. + 获取领英配置时出错。请检查OAuth2LinkedIn实体中是否配置了你的店铺标识(productStoreId)。 + + + Failed to get LinkedIn access token. + 获取领英访问令牌时出错。 + + + Failed to get OAuth2LinkedIn entity: ${errorMessage} + 获取OAuth2LinkedIn实体时出错:${errorMessage} + + + + + Error while redirecting to GitHub authorization URL. Please use other login method for now. + 转到GitHub认证网址时出错。请先使用其它登录方式。 + + + Error while redirecting to GitHub authorization URL: ${errorMessage} + 转到GitHub认证网址时出错:${errorMessage}。 + + + Failed to match the state parameter in GitHub response. Just try to login again. + GitHub响应中的state参数不一致。重试登录即可。 + + + Failed to get LinkedIn authorization code.<br>Error: ${error}<br>Error description: ${error_description} + 获取领英授权码时出错。<br>错误: ${error}<br>错误描述: ${error_description} + + + Failed to get GitHub authorization code. + 获取GitHub授权码时出错。 + + + Failed to get GitHub configuration. Please check whether OAuth2GitHub entity has your productStoreId configured. + 获取GitHub配置时出错。请检查OAuth2GitHub实体中是否配置了你的店铺标识(productStoreId)。 + + + Failed to get GitHub access token: ${error} + 获取GitHub访问令牌时出错:${error} + + + Failed to get OAuth2GitHub entity: ${errorMessage} + 获取OAuth2GitHub实体时出错:${errorMessage} + + diff --git a/passport/config/gitHubAuth.properties b/passport/config/gitHubAuth.properties new file mode 100644 index 000000000..5e661c652 --- /dev/null +++ b/passport/config/gitHubAuth.properties @@ -0,0 +1,24 @@ +############################################################################### +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +############################################################################### + +github.env.prefix=test + +github.authenticator.enabled=true + +# github.group.map.1=github-user=FULLADMIN diff --git a/passport/config/linkedInAuth.properties b/passport/config/linkedInAuth.properties new file mode 100644 index 000000000..defa5fc1b --- /dev/null +++ b/passport/config/linkedInAuth.properties @@ -0,0 +1,24 @@ +############################################################################### +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +############################################################################### + +linkedin.env.prefix=test + +linkedin.authenticator.enabled=true + +# linkedin.group.map.1=linkedin-user=FULLADMIN diff --git a/passport/data/OAuth2CommonSeedData.xml b/passport/data/OAuth2CommonSeedData.xml new file mode 100644 index 000000000..c1e1f4775 --- /dev/null +++ b/passport/data/OAuth2CommonSeedData.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/passport/data/OAuth2GitHubSeedData.xml b/passport/data/OAuth2GitHubSeedData.xml new file mode 100644 index 000000000..bf82eb51c --- /dev/null +++ b/passport/data/OAuth2GitHubSeedData.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/passport/data/OAuth2LinkedInSeedData.xml b/passport/data/OAuth2LinkedInSeedData.xml new file mode 100644 index 000000000..a9a1670c3 --- /dev/null +++ b/passport/data/OAuth2LinkedInSeedData.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/passport/entitydef/entitymodel.xml b/passport/entitydef/entitymodel.xml new file mode 100644 index 000000000..0f09a596e --- /dev/null +++ b/passport/entitydef/entitymodel.xml @@ -0,0 +1,121 @@ + + + + + Entity of Passport Component + Data Model Enhancements For Passport + 1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/passport/ofbiz-component.xml b/passport/ofbiz-component.xml new file mode 100644 index 000000000..edd710ac6 --- /dev/null +++ b/passport/ofbiz-component.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/passport/src/org/ofbiz/passport/event/GitHubEvents.java b/passport/src/org/ofbiz/passport/event/GitHubEvents.java new file mode 100644 index 000000000..076687550 --- /dev/null +++ b/passport/src/org/ofbiz/passport/event/GitHubEvents.java @@ -0,0 +1,322 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.passport.event; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.Map; +import java.util.Random; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.params.HttpMethodParams; +import org.ofbiz.passport.user.GitHubAuthenticator; +import org.ofbiz.passport.util.PassportUtil; +import org.ofbiz.base.conversion.ConversionException; +import org.ofbiz.base.conversion.JSONConverters.JSONToMap; +import org.ofbiz.base.crypto.HashCrypt; +import org.ofbiz.base.lang.JSON; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.common.authentication.api.AuthenticatorException; +import org.ofbiz.common.login.LoginServices; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.product.store.ProductStoreWorker; +import org.ofbiz.service.LocalDispatcher; + +/** + * GitHubEvents - Events for GitHub login. + * + * Refs: https://developer.github.com/v3/oauth/ + * + */ +public class GitHubEvents { + + public static final String module = GitHubEvents.class.getName(); + + public static final String resource = "PassportUiLabels"; + + public static final String AuthorizeUri = "/login/oauth/authorize"; + + public static final String TokenServiceUri = "/login/oauth/access_token"; + + public static final String UserApiUri = "/user"; + + public static final String DEFAULT_SCOPE = "user,gist"; + + public static final String ApiEndpoint = "https://api.github.com"; + + public static final String TokenEndpoint = "https://github.com"; + + public static final String SESSION_GITHUB_STATE = "_GITHUB_STATE_"; + + public static final String envPrefix = UtilProperties.getPropertyValue(GitHubAuthenticator.props, "github.env.prefix", "test"); + + /** + * Redirect to GitHub login page. + * + * @return + */ + public static String gitHubRedirect(HttpServletRequest request, HttpServletResponse response) { + GenericValue oauth2GitHub = getOAuth2GitHubConfig(request); + if (UtilValidate.isEmpty(oauth2GitHub)) { + return "error"; + } + + String clientId = oauth2GitHub.getString(PassportUtil.COMMON_CLIENT_ID); + String returnURI = oauth2GitHub.getString(PassportUtil.COMMON_RETURN_RUL); + + // Get user authorization code + try { + String state = System.currentTimeMillis() + String.valueOf((new Random(10)).nextLong()); + request.getSession().setAttribute(SESSION_GITHUB_STATE, state); + String redirectUrl = TokenEndpoint + AuthorizeUri + + "?client_id=" + clientId + + "&scope=" + DEFAULT_SCOPE + + "&redirect_uri=" + URLEncoder.encode(returnURI, "UTF-8") + + "&state=" + state; + Debug.logInfo("Request to GitHub: " + redirectUrl, module); + response.sendRedirect(redirectUrl); + } catch (NullPointerException e) { + String errMsg = UtilProperties.getMessage(resource, "RedirectToGitHubOAuth2NullException", UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } catch (IOException e) { + Map messageMap = UtilMisc.toMap("errorMessage", e.toString()); + String errMsg = UtilProperties.getMessage(resource, "RedirectToGitHubOAuth2Error", messageMap, UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + + return "success"; + } + + /** + * Parse GitHub login response and login the user if possible. + * + * @return + */ + public static String parseGitHubResponse(HttpServletRequest request, HttpServletResponse response) { + String authorizationCode = request.getParameter(PassportUtil.COMMON_CODE); + String state = request.getParameter(PassportUtil.COMMON_STATE); + if (!state.equals(request.getSession().getAttribute(SESSION_GITHUB_STATE))) { + String errMsg = UtilProperties.getMessage(resource, "GitHubFailedToMatchState", UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + if (UtilValidate.isEmpty(authorizationCode)) { + String error = request.getParameter(PassportUtil.COMMON_ERROR); + String errorDescpriton = request.getParameter(PassportUtil.COMMON_ERROR_DESCRIPTION); + String errMsg = null; + try { + errMsg = UtilProperties.getMessage(resource, "FailedToGetGitHubAuthorizationCode", UtilMisc.toMap(PassportUtil.COMMON_ERROR, error, PassportUtil.COMMON_ERROR_DESCRIPTION, URLDecoder.decode(errorDescpriton, "UTF-8")), UtilHttp.getLocale(request)); + } catch (UnsupportedEncodingException e) { + errMsg = UtilProperties.getMessage(resource, "GetGitHubAuthorizationCodeError", UtilHttp.getLocale(request)); + } + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + Debug.logInfo("GitHub authorization code: " + authorizationCode, module); + + GenericValue oauth2GitHub = getOAuth2GitHubConfig(request); + if (UtilValidate.isEmpty(oauth2GitHub)) { + String errMsg = UtilProperties.getMessage(resource, "GetOAuth2GitHubConfigError", UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + String clientId = oauth2GitHub.getString(PassportUtil.COMMON_CLIENT_ID); + String secret = oauth2GitHub.getString(PassportUtil.COMMON_CLIENT_SECRET); + String returnURI = oauth2GitHub.getString(PassportUtil.COMMON_RETURN_RUL); + + // Grant token from authorization code and oauth2 token + // Use the authorization code to obtain an access token + String accessToken = null; + String tokenType = null; + + HttpClient jsonClient = new HttpClient(); + PostMethod postMethod = new PostMethod(TokenEndpoint + TokenServiceUri); + try { + HttpMethodParams params = new HttpMethodParams(); + String queryString = "client_id=" + clientId + + "&client_secret=" + secret + + "&code=" + authorizationCode + + "&redirect_uri=" + URLEncoder.encode(returnURI, "UTF-8"); + // Debug.logInfo("GitHub get access token query string: " + queryString, module); + postMethod.setQueryString(queryString); + params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); + postMethod.setParams(params); + postMethod.setRequestHeader(PassportUtil.ACCEPT_HEADER, "application/json"); + jsonClient.executeMethod(postMethod); + // Debug.logInfo("GitHub get access token response code: " + postMethod.getStatusCode(), module); + // Debug.logInfo("GitHub get access token response content: " + postMethod.getResponseBodyAsString(1024), module); + if (postMethod.getStatusCode() == HttpStatus.SC_OK) { + // Debug.logInfo("Json Response from GitHub: " + postMethod.getResponseBodyAsString(1024), module); + JSON jsonObject = JSON.from(postMethod.getResponseBodyAsString(1024)); + JSONToMap jsonMap = new JSONToMap(); + Map userMap = jsonMap.convert(jsonObject); + accessToken = (String) userMap.get("access_token"); + tokenType = (String) userMap.get("token_type"); + // Debug.logInfo("Generated Access Token : " + accessToken, module); + // Debug.logInfo("Token Type: " + tokenType, module); + } else { + String errMsg = UtilProperties.getMessage(resource, "GetOAuth2GitHubAccessTokenError", UtilMisc.toMap("error", postMethod.getResponseBodyAsString()), UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + } catch (UnsupportedEncodingException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (HttpException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (IOException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (ConversionException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } finally { + postMethod.releaseConnection(); + } + + // Get User Profile + GetMethod getMethod = new GetMethod(ApiEndpoint + UserApiUri); + Map userInfo = null; + try { + userInfo = GitHubAuthenticator.getUserInfo(getMethod, accessToken, tokenType, UtilHttp.getLocale(request)); + } catch (HttpException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (IOException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (AuthenticatorException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } finally { + getMethod.releaseConnection(); + } + // Debug.logInfo("GitHub User Info:" + userInfo, module); + + // Store the user info and check login the user + return checkLoginGitHubUser(request, userInfo, accessToken); + } + + private static String checkLoginGitHubUser(HttpServletRequest request, Map userInfo, String accessToken) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + String productStoreId = ProductStoreWorker.getProductStoreId(request); + String gitHubUserId = (String) userInfo.get("login"); + GenericValue gitHubUser = null; + try { + gitHubUser = delegator.findOne("GitHubUser", UtilMisc.toMap("gitHubUserId", gitHubUserId), false); + } catch (GenericEntityException e) { + request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); + return "error"; + } + if (UtilValidate.isNotEmpty(gitHubUser)) { + boolean dataChanged = false; + if (!accessToken.equals(gitHubUser.getString("accessToken"))) { + gitHubUser.set("accessToken", accessToken); + dataChanged = true; + } + if (!envPrefix.equals(gitHubUser.getString("envPrefix"))) { + gitHubUser.set("envPrefix", envPrefix); + dataChanged = true; + } + if (!productStoreId.equals(gitHubUser.getString("productStoreId"))) { + gitHubUser.set("productStoreId", productStoreId); + dataChanged = true; + } + if (dataChanged) { + try { + gitHubUser.store(); + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + } + } + } else { + gitHubUser = delegator.makeValue("GitHubUser", UtilMisc.toMap("accessToken", accessToken, + "productStoreId", productStoreId, + "envPrefix", envPrefix, + "gitHubUserId", gitHubUserId)); + try { + gitHubUser.create(); + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + } + } + try { + GenericValue userLogin = EntityUtil.getFirst(delegator.findByAnd("UserLogin", UtilMisc.toMap("externalAuthId", gitHubUserId), null, false)); + GitHubAuthenticator authn = new GitHubAuthenticator(); + authn.initialize(dispatcher); + if (UtilValidate.isEmpty(userLogin)) { + String userLoginId = authn.createUser(userInfo); + userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false); + } + String password = PassportUtil.randomString(); + boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt")); + userLogin.set("currentPassword", useEncryption ? HashCrypt.digestHash(LoginServices.getHashType(), null, password) : password); + userLogin.store(); + request.setAttribute("USERNAME", userLogin.getString("userLoginId")); + request.setAttribute("PASSWORD", password); + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (AuthenticatorException e) { + Debug.logError(e.getMessage(), module); + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } + return "success"; + } + + public static GenericValue getOAuth2GitHubConfig(HttpServletRequest request) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + String productStoreId = ProductStoreWorker.getProductStoreId(request); + try { + return getOAuth2GitHubConfig(delegator, productStoreId); + } catch (GenericEntityException e) { + Map messageMap = UtilMisc.toMap("errorMessage", e.toString()); + String errMsg = UtilProperties.getMessage(resource, "GetOAuth2GitHubError", messageMap, UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + } + return null; + } + + public static GenericValue getOAuth2GitHubConfig(Delegator delegator, String productStoreId) throws GenericEntityException { + return EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("OAuth2GitHub", UtilMisc.toMap("productStoreId", productStoreId), null, false))); + } +} diff --git a/passport/src/org/ofbiz/passport/event/LinkedInEvents.java b/passport/src/org/ofbiz/passport/event/LinkedInEvents.java new file mode 100644 index 000000000..1ed10af20 --- /dev/null +++ b/passport/src/org/ofbiz/passport/event/LinkedInEvents.java @@ -0,0 +1,326 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.passport.event; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.Map; +import java.util.Random; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.params.HttpMethodParams; +import org.ofbiz.passport.user.LinkedInAuthenticator; +import org.ofbiz.passport.util.PassportUtil; +import org.ofbiz.base.conversion.ConversionException; +import org.ofbiz.base.conversion.JSONConverters.JSONToMap; +import org.ofbiz.base.crypto.HashCrypt; +import org.ofbiz.base.lang.JSON; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.common.authentication.api.AuthenticatorException; +import org.ofbiz.common.login.LoginServices; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.product.store.ProductStoreWorker; +import org.ofbiz.service.LocalDispatcher; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +/** + * LinkedEvents - Events for LinkedIn login. + * + * Refs: https://developer.linkedin.com/documents/authentication + * + */ +public class LinkedInEvents { + + public static final String module = LinkedInEvents.class.getName(); + + public static final String resource = "PassportUiLabels"; + + public static final String AuthorizeUri = "/uas/oauth2/authorization"; + + public static final String TokenServiceUri = "/uas/oauth2/accessToken"; + + public static final String UserApiUri = "/v1/people/~"; + + public static final String DEFAULT_SCOPE = "r_basicprofile%20r_emailaddress"; + + public static final String TokenEndpoint = "https://www.linkedin.com"; + + public static final String SESSION_LINKEDIN_STATE = "_LINKEDIN_STATE_"; + + public static final String envPrefix = UtilProperties.getPropertyValue(LinkedInAuthenticator.props, "linkedin.env.prefix", "test"); + + /** + * Redirect to LinkedIn login page. + * + * @return + */ + public static String linkedInRedirect(HttpServletRequest request, HttpServletResponse response) { + GenericValue oauth2LinkedIn = getOAuth2LinkedInConfig(request); + if (UtilValidate.isEmpty(oauth2LinkedIn)) { + return "error"; + } + + String clientId = oauth2LinkedIn.getString(PassportUtil.ApiKeyLabel); + String returnURI = oauth2LinkedIn.getString(envPrefix + PassportUtil.ReturnUrlLabel); + + // Get user authorization code + try { + String state = System.currentTimeMillis() + String.valueOf((new Random(10)).nextLong()); + request.getSession().setAttribute(SESSION_LINKEDIN_STATE, state); + String redirectUrl = TokenEndpoint + AuthorizeUri + + "?client_id=" + clientId + + "&response_type=code" + + "&scope=" + DEFAULT_SCOPE + + "&redirect_uri=" + URLEncoder.encode(returnURI, "UTF-8") + + "&state=" + state; + response.sendRedirect(redirectUrl); + } catch (NullPointerException e) { + String errMsg = UtilProperties.getMessage(resource, "RedirectToLinkedInOAuth2NullException", UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } catch (IOException e) { + Map messageMap = UtilMisc.toMap("errorMessage", e.toString()); + String errMsg = UtilProperties.getMessage(resource, "RedirectToLinkedInOAuth2Error", messageMap, UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + + return "success"; + } + + /** + * Parse LinkedIn login response and login the user if possible. + * + * @return + */ + public static String parseLinkedInResponse(HttpServletRequest request, HttpServletResponse response) { + String authorizationCode = request.getParameter(PassportUtil.COMMON_CODE); + String state = request.getParameter(PassportUtil.COMMON_STATE); + if (!state.equals(request.getSession().getAttribute(SESSION_LINKEDIN_STATE))) { + String errMsg = UtilProperties.getMessage(resource, "LinkedInFailedToMatchState", UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + if (UtilValidate.isEmpty(authorizationCode)) { + String error = request.getParameter(PassportUtil.COMMON_ERROR); + String errorDescpriton = request.getParameter(PassportUtil.COMMON_ERROR_DESCRIPTION); + String errMsg = null; + try { + errMsg = UtilProperties.getMessage(resource, "FailedToGetLinkedInAuthorizationCode", UtilMisc.toMap(PassportUtil.COMMON_ERROR, error, PassportUtil.COMMON_ERROR_DESCRIPTION, URLDecoder.decode(errorDescpriton, "UTF-8")), UtilHttp.getLocale(request)); + } catch (UnsupportedEncodingException e) { + errMsg = UtilProperties.getMessage(resource, "GetLinkedInAuthorizationCodeError", UtilHttp.getLocale(request)); + } + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + // Debug.logInfo("LinkedIn authorization code: " + authorizationCode, module); + + GenericValue oauth2LinkedIn = getOAuth2LinkedInConfig(request); + if (UtilValidate.isEmpty(oauth2LinkedIn)) { + String errMsg = UtilProperties.getMessage(resource, "GetOAuth2LinkedInConfigError", UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + String clientId = oauth2LinkedIn.getString(PassportUtil.ApiKeyLabel); + String secret = oauth2LinkedIn.getString(PassportUtil.SecretKeyLabel); + String returnURI = oauth2LinkedIn.getString(envPrefix + PassportUtil.ReturnUrlLabel); + + // Grant token from authorization code and oauth2 token + // Use the authorization code to obtain an access token + String accessToken = null; + + HttpClient jsonClient = new HttpClient(); + PostMethod postMethod = new PostMethod(TokenEndpoint + TokenServiceUri); + try { + HttpMethodParams params = new HttpMethodParams(); + String queryString = "client_id=" + clientId + + "&client_secret=" + secret + + "&grant_type=authorization_code" + + "&code=" + authorizationCode + + "&redirect_uri=" + URLEncoder.encode(returnURI, "UTF-8"); + // Debug.logInfo("LinkedIn get access token query string: " + queryString, module); + postMethod.setQueryString(queryString); + params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); + postMethod.setParams(params); + jsonClient.executeMethod(postMethod); + // Debug.logInfo("LinkedIn get access token response code: " + postMethod.getStatusCode(), module); + // Debug.logInfo("LinkedIn get access token response content: " + postMethod.getResponseBodyAsString(1024), module); + if (postMethod.getStatusCode() == HttpStatus.SC_OK) { + // Debug.logInfo("Json Response from LinkedIn: " + postMethod.getResponseBodyAsString(1024), module); + JSON jsonObject = JSON.from(postMethod.getResponseBodyAsString(1024)); + JSONToMap jsonMap = new JSONToMap(); + Map userMap = jsonMap.convert(jsonObject); + accessToken = (String) userMap.get("access_token"); + // Debug.logInfo("Generated Access Token : " + accessToken, module); + } else { + String errMsg = UtilProperties.getMessage(resource, "GetOAuth2LinkedInAccessTokenError", UtilMisc.toMap("error", postMethod.getResponseBodyAsString()), UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + } catch (UnsupportedEncodingException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (HttpException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (IOException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (ConversionException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } finally { + postMethod.releaseConnection(); + } + + // Get User Profile + GetMethod getMethod = new GetMethod(TokenEndpoint + UserApiUri + "?oauth2_access_token=" + accessToken); + Document userInfo = null; + try { + userInfo = LinkedInAuthenticator.getUserInfo(getMethod, UtilHttp.getLocale(request)); + } catch (HttpException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (IOException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (AuthenticatorException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (SAXException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (ParserConfigurationException e) { + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } finally { + getMethod.releaseConnection(); + } + // Debug.logInfo("LinkedIn User Info:" + userInfo, module); + + // Store the user info and check login the user + return checkLoginLinkedInUser(request, userInfo, accessToken); + } + + private static String checkLoginLinkedInUser(HttpServletRequest request, Document userInfo, String accessToken) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + String productStoreId = ProductStoreWorker.getProductStoreId(request); + String linkedInUserId = LinkedInAuthenticator.getLinkedInUserId(userInfo); + GenericValue linkedInUser = null; + try { + linkedInUser = delegator.findOne("LinkedInUser", UtilMisc.toMap("linkedInUserId", linkedInUserId), false); + } catch (GenericEntityException e) { + request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); + return "error"; + } + if (UtilValidate.isNotEmpty(linkedInUser)) { + boolean dataChanged = false; + if (!accessToken.equals(linkedInUser.getString("accessToken"))) { + linkedInUser.set("accessToken", accessToken); + dataChanged = true; + } + if (!envPrefix.equals(linkedInUser.getString("envPrefix"))) { + linkedInUser.set("envPrefix", envPrefix); + dataChanged = true; + } + if (!productStoreId.equals(linkedInUser.getString("productStoreId"))) { + linkedInUser.set("productStoreId", productStoreId); + dataChanged = true; + } + if (dataChanged) { + try { + linkedInUser.store(); + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + } + } + } else { + linkedInUser = delegator.makeValue("LinkedInUser", UtilMisc.toMap("accessToken", accessToken, + "productStoreId", productStoreId, + "envPrefix", envPrefix, + "linkedInUserId", linkedInUserId)); + try { + linkedInUser.create(); + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + } + } + try { + GenericValue userLogin = EntityUtil.getFirst(delegator.findByAnd("UserLogin", UtilMisc.toMap("externalAuthId", linkedInUserId), null, false)); + LinkedInAuthenticator authn = new LinkedInAuthenticator(); + authn.initialize(dispatcher); + if (UtilValidate.isEmpty(userLogin)) { + String userLoginId = authn.createUser(userInfo); + userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false); + } + String password = PassportUtil.randomString(); + boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt")); + userLogin.set("currentPassword", useEncryption ? HashCrypt.digestHash(LoginServices.getHashType(), null, password) : password); + userLogin.store(); + request.setAttribute("USERNAME", userLogin.getString("userLoginId")); + request.setAttribute("PASSWORD", password); + } catch (GenericEntityException e) { + Debug.logError(e.getMessage(), module); + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } catch (AuthenticatorException e) { + Debug.logError(e.getMessage(), module); + request.setAttribute("_ERROR_MESSAGE_", e.toString()); + return "error"; + } + return "success"; + } + + public static GenericValue getOAuth2LinkedInConfig(HttpServletRequest request) { + Delegator delegator = (Delegator) request.getAttribute("delegator"); + String productStoreId = ProductStoreWorker.getProductStoreId(request); + try { + return getOAuth2LinkedInConfig(delegator, productStoreId); + } catch (GenericEntityException e) { + Map messageMap = UtilMisc.toMap("errorMessage", e.toString()); + String errMsg = UtilProperties.getMessage(resource, "GetOAuth2LinkedInError", messageMap, UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + } + return null; + } + + public static GenericValue getOAuth2LinkedInConfig(Delegator delegator, String productStoreId) throws GenericEntityException { + return EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("OAuth2LinkedIn", UtilMisc.toMap("productStoreId", productStoreId), null, false))); + } +} diff --git a/passport/src/org/ofbiz/passport/user/GitHubAuthenticator.java b/passport/src/org/ofbiz/passport/user/GitHubAuthenticator.java new file mode 100644 index 000000000..d241a793f --- /dev/null +++ b/passport/src/org/ofbiz/passport/user/GitHubAuthenticator.java @@ -0,0 +1,416 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.passport.user; + +import java.util.Locale; +import java.util.Map; +import java.io.IOException; +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.transaction.Transaction; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.params.HttpMethodParams; +import org.ofbiz.passport.event.GitHubEvents; +import org.ofbiz.passport.user.GitHubUserGroupMapper; +import org.ofbiz.passport.util.PassportUtil; +import org.ofbiz.common.authentication.api.Authenticator; +import org.ofbiz.common.authentication.api.AuthenticatorException; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.ServiceUtil; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.transaction.TransactionUtil; +import org.ofbiz.entity.transaction.GenericTransactionException; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.base.conversion.ConversionException; +import org.ofbiz.base.conversion.JSONConverters.JSONToMap; +import org.ofbiz.base.lang.JSON; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilValidate; + +import javolution.util.FastMap; + +/** + * GitHub OFBiz Authenticator + */ +public class GitHubAuthenticator implements Authenticator { + + private static final String module = GitHubAuthenticator.class.getName(); + + public static final String props = "gitHubAuth.properties"; + + public static final String resource = "PassportUiLabels"; + + protected LocalDispatcher dispatcher; + + protected Delegator delegator; + + /** + * Method called when authenticator is first initialized (the delegator + * object can be obtained from the LocalDispatcher) + * + * @param dispatcher The ServiceDispatcher to use for this Authenticator + */ + public void initialize(LocalDispatcher dispatcher) { + this.dispatcher = dispatcher; + this.delegator = dispatcher.getDelegator(); + } + + /** + * Method to authenticate a user. + * + * For GitHub users, we only check if the username(userLoginId) exists an + * externalAuthId, and the externalAuthId has a valid accessToken in + * GitHubUser entity. + * + * @param username User's username + * @param password User's password + * @param isServiceAuth true if authentication is for a service call + * @return true if the user is authenticated + * @throws org.ofbiz.common.authentication.api.AuthenticatorException + * when a fatal error occurs during authentication + */ + public boolean authenticate(String userLoginId, String password, boolean isServiceAuth) throws AuthenticatorException { + Map user = null; + GetMethod getMethod = null; + try { + GenericValue userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false); + String externalAuthId = userLogin.getString("externalAuthId"); + GenericValue gitHubUser = delegator.findOne("GitHubUser", UtilMisc.toMap("gitHubUserId", externalAuthId), false); + if (UtilValidate.isNotEmpty(gitHubUser)) { + String accessToken = gitHubUser.getString("accessToken"); + String tokenType = gitHubUser.getString("tokenType"); + if (UtilValidate.isNotEmpty(accessToken)) { + getMethod = new GetMethod(GitHubEvents.ApiEndpoint + GitHubEvents.UserApiUri); + user = GitHubAuthenticator.getUserInfo(getMethod, accessToken, tokenType, Locale.getDefault()); + } + } + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (HttpException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (IOException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (AuthenticatorException e) { + throw new AuthenticatorException(e.getMessage(), e); + } finally { + if (getMethod != null) { + getMethod.releaseConnection(); + } + } + + Debug.logInfo("GitHub auth called; returned user info: " + user, module); + return user != null; + } + + /** + * Logs a user out + * + * @param username User's username + * @throws org.ofbiz.common.authentication.api.AuthenticatorException + * when logout fails + */ + public void logout(String username) throws AuthenticatorException { + } + + /** + * Reads user information and syncs it to OFBiz (i.e. UserLogin, Person, etc) + * + * @param userLoginId + * @throws org.ofbiz.common.authentication.api.AuthenticatorException + * user synchronization fails + */ + public void syncUser(String userLoginId) throws AuthenticatorException { + Map userMap = getGitHubUserinfo(userLoginId); + GenericValue system; + try { + system = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + + GenericValue userLogin; + try { + userLogin = EntityUtil.getFirst(delegator.findByAnd("UserLogin", UtilMisc.toMap("externalAuthId", (String) userMap.get("id")), null, false)); + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + + // suspend the current transaction and load the user + Transaction parentTx = null; + boolean beganTransaction = false; + + try { + try { + parentTx = TransactionUtil.suspend(); + } catch (GenericTransactionException e) { + Debug.logError(e, "Could not suspend transaction: " + e.getMessage(), module); + } + + try { + beganTransaction = TransactionUtil.begin(); + + if (userLogin == null) { + // create the user + createUser(userMap, system); + } else { + // update the user information + updateUser(userMap, system, userLogin); + } + + } catch (GenericTransactionException e) { + Debug.logError(e, "Could not suspend transaction: " + e.getMessage(), module); + } finally { + try { + TransactionUtil.commit(beganTransaction); + } catch (GenericTransactionException e) { + Debug.logError(e, "Could not commit nested transaction: " + e.getMessage(), module); + } + } + } finally { + // resume/restore parent transaction + if (parentTx != null) { + try { + TransactionUtil.resume(parentTx); + Debug.logVerbose("Resumed the parent transaction.", module); + } catch (GenericTransactionException e) { + Debug.logError(e, "Could not resume parent nested transaction: " + e.getMessage(), module); + } + } + } + } + + private Map getGitHubUserinfo(String userLoginId) throws AuthenticatorException { + Map user = null; + GetMethod getMethod = null; + try { + GenericValue userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false); + String externalAuthId = userLogin.getString("externalAuthId"); + GenericValue gitHubUser = delegator.findOne("GitHubUser", UtilMisc.toMap("gitHubUserId", externalAuthId), false); + if (UtilValidate.isNotEmpty(gitHubUser)) { + String accessToken = gitHubUser.getString("accessToken"); + String tokenType = gitHubUser.getString("tokenType"); + if (UtilValidate.isNotEmpty(accessToken)) { + getMethod = new GetMethod(GitHubEvents.ApiEndpoint + GitHubEvents.UserApiUri); + user = getUserInfo(getMethod, accessToken, tokenType, Locale.getDefault()); + } + } + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (HttpException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (IOException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (AuthenticatorException e) { + throw new AuthenticatorException(e.getMessage(), e); + } finally { + if (getMethod != null) { + getMethod.releaseConnection(); + } + } + return user; + } + + public String createUser(Map userMap) throws AuthenticatorException { + GenericValue system; + try { + system = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + return createUser(userMap, system); + } + + private String createUser(Map userMap, GenericValue system) throws AuthenticatorException { + // create person + userLogin + Map createPersonUlMap = FastMap.newInstance(); + String userLoginId = delegator.getNextSeqId("UserLogin"); + if (userMap.containsKey("name")) { + // use github's name as OFBiz's lastName + createPersonUlMap.put("lastName", (String) userMap.get("name")); + } + if (userMap.containsKey("login")) { + createPersonUlMap.put("externalAuthId", (String) userMap.get("login")); + } + // createPersonUlMap.put("externalId", user.getUserId()); + createPersonUlMap.put("userLoginId", userLoginId); + createPersonUlMap.put("currentPassword", "[EXTERNAL]"); + createPersonUlMap.put("currentPasswordVerify", "[EXTERNAL]"); + createPersonUlMap.put("userLogin", system); + Map createPersonResult; + try { + createPersonResult = dispatcher.runSync("createPersonAndUserLogin", createPersonUlMap); + } catch (GenericServiceException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + if (ServiceUtil.isError(createPersonResult)) { + throw new AuthenticatorException(ServiceUtil.getErrorMessage(createPersonResult)); + } + String partyId = (String) createPersonResult.get("partyId"); + + // give this person a role of CUSTOMER + GenericValue partyRole = delegator.makeValue("PartyRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "CUSTOMER")); + try { + delegator.create(partyRole); + } catch (GenericEntityException e) { + Debug.logError(e, module); + throw new AuthenticatorException(e.getMessage(), e); + } + + // create email + if (userMap.containsKey("email")) { + Map createEmailMap = FastMap.newInstance(); + createEmailMap.put("emailAddress", (String) userMap.get("email")); + createEmailMap.put("contactMechPurposeTypeId", "PRIMARY_EMAIL"); + createEmailMap.put("partyId", partyId); + createEmailMap.put("userLogin", system); + Map createEmailResult; + try { + createEmailResult = dispatcher.runSync("createPartyEmailAddress", createEmailMap); + } catch (GenericServiceException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + if (ServiceUtil.isError(createEmailResult)) { + throw new AuthenticatorException(ServiceUtil.getErrorMessage(createEmailResult)); + } + } + + // create security group(s) + Timestamp now = UtilDateTime.nowTimestamp(); + for (String securityGroup : (new GitHubUserGroupMapper(new String[] {(String) userMap.get("type")}).getSecurityGroups())) { + // check and make sure the security group exists + GenericValue secGroup = null; + try { + secGroup = delegator.findOne("SecurityGroup", UtilMisc.toMap("groupId", securityGroup), true); + } catch (GenericEntityException e) { + Debug.logError(e, e.getMessage(), module); + } + + // add it to the user if it exists + if (secGroup != null) { + Map createSecGrpMap = FastMap.newInstance(); + createSecGrpMap.put("userLoginId", userLoginId); + createSecGrpMap.put("groupId", securityGroup); + createSecGrpMap.put("fromDate", now); + createSecGrpMap.put("userLogin", system); + + Map createSecGrpResult; + try { + createSecGrpResult = dispatcher.runSync("addUserLoginToSecurityGroup", createSecGrpMap); + } catch (GenericServiceException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + if (ServiceUtil.isError(createSecGrpResult)) { + throw new AuthenticatorException(ServiceUtil.getErrorMessage(createSecGrpResult)); + } + } + } + return userLoginId; + } + + private void updateUser(Map userMap, GenericValue system, GenericValue userLogin) throws AuthenticatorException { + // TODO implement me + } + + /** + * Updates a user's password. + * + * @param username User's username + * @param password User's current password + * @param newPassword User's new password + * @throws org.ofbiz.common.authentication.api.AuthenticatorException + * when update password fails + */ + public void updatePassword(String username, String password, String newPassword) throws AuthenticatorException { + Debug.logInfo("Calling GitHub:updatePassword() - ignored!!!", module); + } + + /** + * Weight of this authenticator (lower weights are run first) + * + * @return the weight of this Authenicator + */ + public float getWeight() { + return 1; + } + + /** + * Is the user synchronzied back to OFBiz + * + * @return true if the user record is copied to the OFB database + */ + public boolean isUserSynchronized() { + return true; + } + + /** + * Is this expected to be the only authenticator, if so errors will be thrown when users cannot be found + * + * @return true if this is expected to be the only Authenticator + */ + public boolean isSingleAuthenticator() { + return false; + } + + /** + * Flag to test if this Authenticator is enabled + * + * @return true if the Authenticator is enabled + */ + public boolean isEnabled() { + return "true".equalsIgnoreCase(UtilProperties.getPropertyValue(props, "github.authenticator.enabled", "true")); + } + + public static Map getUserInfo(GetMethod getMethod, String accessToken, String tokenType, Locale locale) throws HttpException, IOException, AuthenticatorException { + JSON userInfo = null; + HttpClient jsonClient = new HttpClient(); + HttpMethodParams params = new HttpMethodParams(); + params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); + getMethod.setParams(params); + getMethod.setRequestHeader(PassportUtil.AUTHORIZATION_HEADER, tokenType + " " + accessToken); + getMethod.setRequestHeader(PassportUtil.ACCEPT_HEADER, "application/json"); + jsonClient.executeMethod(getMethod); + if (getMethod.getStatusCode() == HttpStatus.SC_OK) { + Debug.logInfo("Json Response from GitHub: " + getMethod.getResponseBodyAsString(), module); + userInfo = JSON.from(getMethod.getResponseBodyAsString()); + } else { + String errMsg = UtilProperties.getMessage(resource, "GetOAuth2AccessTokenError", UtilMisc.toMap("error", getMethod.getResponseBodyAsString()), locale); + throw new AuthenticatorException(errMsg); + } + JSONToMap jsonMap = new JSONToMap(); + Map userMap; + try { + userMap = jsonMap.convert(userInfo); + } catch (ConversionException e) { + throw new AuthenticatorException(e.getMessage()); + } + return userMap; + } +} diff --git a/passport/src/org/ofbiz/passport/user/GitHubUserGroupMapper.java b/passport/src/org/ofbiz/passport/user/GitHubUserGroupMapper.java new file mode 100644 index 000000000..7f452af02 --- /dev/null +++ b/passport/src/org/ofbiz/passport/user/GitHubUserGroupMapper.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.passport.user; + +import java.util.List; +import java.util.Properties; +import java.util.Arrays; +import java.util.Set; + +import org.ofbiz.base.util.UtilProperties; + +import javolution.util.FastList; +import javolution.util.FastSet; + +/** + * GitHub UserGroupMapper + */ +public class GitHubUserGroupMapper { + + protected List groups; + + public GitHubUserGroupMapper(String[] groups) { + this.groups = Arrays.asList(groups); + } + + public GitHubUserGroupMapper(String group) { + if (groups == null) { + groups = FastList.newInstance(); + } + groups.add(group); + } + + public Set getSecurityGroups() { + Properties props = UtilProperties.getProperties(GitHubAuthenticator.props); + + Set secGroups = FastSet.newInstance(); + boolean running = true; + int index = 1; + + while (running) { + String groupStr = (String) props.get("github.group.map." + index); + if (groupStr == null) { + running = false; + } else { + String[] groupSplit = groupStr.split("="); + if (groupSplit.length == 2) { + if (groups.contains(groupSplit[0])) { + secGroups.add(groupSplit[1]); + } + } + } + index++; + } + return secGroups; + } +} diff --git a/passport/src/org/ofbiz/passport/user/LinkedInAuthenticator.java b/passport/src/org/ofbiz/passport/user/LinkedInAuthenticator.java new file mode 100644 index 000000000..4f7e64417 --- /dev/null +++ b/passport/src/org/ofbiz/passport/user/LinkedInAuthenticator.java @@ -0,0 +1,471 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.passport.user; + +import java.util.Locale; +import java.util.Map; +import java.io.IOException; +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.transaction.Transaction; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.params.HttpMethodParams; +import org.ofbiz.passport.event.LinkedInEvents; +import org.ofbiz.common.authentication.api.Authenticator; +import org.ofbiz.common.authentication.api.AuthenticatorException; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.GenericServiceException; +import org.ofbiz.service.ServiceUtil; +import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.transaction.TransactionUtil; +import org.ofbiz.entity.transaction.GenericTransactionException; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.base.util.UtilXml; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import javolution.util.FastMap; + +/** + * LinkedIn OFBiz Authenticator + */ +public class LinkedInAuthenticator implements Authenticator { + + private static final String module = LinkedInAuthenticator.class.getName(); + + public static final String props = "linkedInAuth.properties"; + + public static final String resource = "PassportUiLabels"; + + protected LocalDispatcher dispatcher; + + protected Delegator delegator; + + /** + * Method called when authenticator is first initialized (the delegator + * object can be obtained from the LocalDispatcher) + * + * @param dispatcher The ServiceDispatcher to use for this Authenticator + */ + public void initialize(LocalDispatcher dispatcher) { + this.dispatcher = dispatcher; + this.delegator = dispatcher.getDelegator(); + } + + /** + * Method to authenticate a user. + * + * For LinkedIn users, we only check if the username(userLoginId) exists an + * externalAuthId, and the externalAuthId has a valid accessToken in + * LinkedInUser entity. + * + * @param username User's username + * @param password User's password + * @param isServiceAuth true if authentication is for a service call + * @return true if the user is authenticated + * @throws org.ofbiz.common.authentication.api.AuthenticatorException + * when a fatal error occurs during authentication + */ + public boolean authenticate(String userLoginId, String password, boolean isServiceAuth) throws AuthenticatorException { + Document user = null; + GetMethod getMethod = null; + try { + GenericValue userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false); + String externalAuthId = userLogin.getString("externalAuthId"); + GenericValue linkedInUser = delegator.findOne("LinkedInUser", UtilMisc.toMap("linedInUserId", externalAuthId), false); + if (UtilValidate.isNotEmpty(linkedInUser)) { + String accessToken = linkedInUser.getString("accessToken"); + if (UtilValidate.isNotEmpty(accessToken)) { + getMethod = new GetMethod(LinkedInEvents.TokenEndpoint + LinkedInEvents.UserApiUri + "?oauth2_access_token=" + accessToken); + user = LinkedInAuthenticator.getUserInfo(getMethod, Locale.getDefault()); + } + } + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (HttpException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (IOException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (AuthenticatorException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (SAXException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (ParserConfigurationException e) { + throw new AuthenticatorException(e.getMessage(), e); + } finally { + if (getMethod != null) { + getMethod.releaseConnection(); + } + } + + Debug.logInfo("LinkedIn auth called; returned user info: " + user, module); + return user != null; + } + + /** + * Logs a user out + * + * @param username User's username + * @throws org.ofbiz.common.authentication.api.AuthenticatorException + * when logout fails + */ + public void logout(String username) throws AuthenticatorException { + } + + /** + * Reads user information and syncs it to OFBiz (i.e. UserLogin, Person, etc) + * + * @param userLoginId + * @throws org.ofbiz.common.authentication.api.AuthenticatorException + * user synchronization fails + */ + public void syncUser(String userLoginId) throws AuthenticatorException { + Document user = getLinkedInUserinfo(userLoginId); + + GenericValue system; + try { + system = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + + GenericValue userLogin; + try { + userLogin = EntityUtil.getFirst(delegator.findByAnd("UserLogin", UtilMisc.toMap("externalAuthId", getLinkedInUserId(user)), null, false)); + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + + // suspend the current transaction and load the user + Transaction parentTx = null; + boolean beganTransaction = false; + + try { + try { + parentTx = TransactionUtil.suspend(); + } catch (GenericTransactionException e) { + Debug.logError(e, "Could not suspend transaction: " + e.getMessage(), module); + } + + try { + beganTransaction = TransactionUtil.begin(); + + if (userLogin == null) { + // create the user + createUser(user, system); + } else { + // update the user information + updateUser(user, system, userLogin); + } + + } catch (GenericTransactionException e) { + Debug.logError(e, "Could not suspend transaction: " + e.getMessage(), module); + } finally { + try { + TransactionUtil.commit(beganTransaction); + } catch (GenericTransactionException e) { + Debug.logError(e, "Could not commit nested transaction: " + e.getMessage(), module); + } + } + } finally { + // resume/restore parent transaction + if (parentTx != null) { + try { + TransactionUtil.resume(parentTx); + Debug.logVerbose("Resumed the parent transaction.", module); + } catch (GenericTransactionException e) { + Debug.logError(e, "Could not resume parent nested transaction: " + e.getMessage(), module); + } + } + } + } + + private Document getLinkedInUserinfo(String userLoginId) throws AuthenticatorException { + Document user = null; + GetMethod getMethod = null; + try { + GenericValue userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false); + String externalAuthId = userLogin.getString("externalAuthId"); + GenericValue linkedInUser = delegator.findOne("LinkedInUser", UtilMisc.toMap("linkedInUserId", externalAuthId), false); + if (UtilValidate.isNotEmpty(linkedInUser)) { + String accessToken = linkedInUser.getString("accessToken"); + if (UtilValidate.isNotEmpty(accessToken)) { + getMethod = new GetMethod(LinkedInEvents.TokenEndpoint + LinkedInEvents.UserApiUri + "?oauth2_access_token=" + accessToken); + user = getUserInfo(getMethod, Locale.getDefault()); + } + } + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (HttpException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (IOException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (AuthenticatorException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (SAXException e) { + throw new AuthenticatorException(e.getMessage(), e); + } catch (ParserConfigurationException e) { + throw new AuthenticatorException(e.getMessage(), e); + } finally { + if (getMethod != null) { + getMethod.releaseConnection(); + } + } + return user; + } + + public String createUser(Document user) throws AuthenticatorException { + GenericValue system; + try { + system = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true); + } catch (GenericEntityException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + return createUser(user, system); + } + + private String createUser(Document user, GenericValue system) throws AuthenticatorException { + Map userInfo = parseLinkedInUserInfo(user); + + // create person + userLogin + Map createPersonUlMap = FastMap.newInstance(); + String userLoginId = delegator.getNextSeqId("UserLogin"); + if (userInfo.containsKey("firstName")) { + createPersonUlMap.put("firstName", userInfo.get("firstName")); + } + if (userInfo.containsKey("lastName")) { + createPersonUlMap.put("lastName", userInfo.get("lastName")); + } + if (userInfo.containsKey("userId")) { + createPersonUlMap.put("externalAuthId", userInfo.get("userId")); + } + // createPersonUlMap.put("externalId", user.getUserId()); + createPersonUlMap.put("userLoginId", userLoginId); + createPersonUlMap.put("currentPassword", "[EXTERNAL]"); + createPersonUlMap.put("currentPasswordVerify", "[EXTERNAL]"); + createPersonUlMap.put("userLogin", system); + Map createPersonResult; + try { + createPersonResult = dispatcher.runSync("createPersonAndUserLogin", createPersonUlMap); + } catch (GenericServiceException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + if (ServiceUtil.isError(createPersonResult)) { + throw new AuthenticatorException(ServiceUtil.getErrorMessage(createPersonResult)); + } + String partyId = (String) createPersonResult.get("partyId"); + + // give this person a role of CUSTOMER + GenericValue partyRole = delegator.makeValue("PartyRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "CUSTOMER")); + try { + delegator.create(partyRole); + } catch (GenericEntityException e) { + Debug.logError(e, module); + throw new AuthenticatorException(e.getMessage(), e); + } + + // create email + if (userInfo.containsKey("emailAddress")) { + Map createEmailMap = FastMap.newInstance(); + createEmailMap.put("emailAddress", userInfo.get("emailAddress")); + createEmailMap.put("contactMechPurposeTypeId", "PRIMARY_EMAIL"); + createEmailMap.put("partyId", partyId); + createEmailMap.put("userLogin", system); + Map createEmailResult; + try { + createEmailResult = dispatcher.runSync("createPartyEmailAddress", createEmailMap); + } catch (GenericServiceException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + if (ServiceUtil.isError(createEmailResult)) { + throw new AuthenticatorException(ServiceUtil.getErrorMessage(createEmailResult)); + } + } + + // create security group(s) + Timestamp now = UtilDateTime.nowTimestamp(); + for (String securityGroup : (new LinkedInUserGroupMapper(new String[] {"person"}).getSecurityGroups())) { + // check and make sure the security group exists + GenericValue secGroup = null; + try { + secGroup = delegator.findOne("SecurityGroup", UtilMisc.toMap("groupId", securityGroup), true); + } catch (GenericEntityException e) { + Debug.logError(e, e.getMessage(), module); + } + + // add it to the user if it exists + if (secGroup != null) { + Map createSecGrpMap = FastMap.newInstance(); + createSecGrpMap.put("userLoginId", userLoginId); + createSecGrpMap.put("groupId", securityGroup); + createSecGrpMap.put("fromDate", now); + createSecGrpMap.put("userLogin", system); + + Map createSecGrpResult; + try { + createSecGrpResult = dispatcher.runSync("addUserLoginToSecurityGroup", createSecGrpMap); + } catch (GenericServiceException e) { + throw new AuthenticatorException(e.getMessage(), e); + } + if (ServiceUtil.isError(createSecGrpResult)) { + throw new AuthenticatorException(ServiceUtil.getErrorMessage(createSecGrpResult)); + } + } + } + return userLoginId; + } + + private void updateUser(Document user, GenericValue system, GenericValue userLogin) throws AuthenticatorException { + // TODO implement me + } + + /** + * Updates a user's password. + * + * @param username User's username + * @param password User's current password + * @param newPassword User's new password + * @throws org.ofbiz.common.authentication.api.AuthenticatorException + * when update password fails + */ + public void updatePassword(String username, String password, String newPassword) throws AuthenticatorException { + Debug.logInfo("Calling LinkedIn:updatePassword() - ignored!!!", module); + } + + /** + * Weight of this authenticator (lower weights are run first) + * + * @return the weight of this Authenicator + */ + public float getWeight() { + return 1; + } + + /** + * Is the user synchronzied back to OFBiz + * + * @return true if the user record is copied to the OFB database + */ + public boolean isUserSynchronized() { + return true; + } + + /** + * Is this expected to be the only authenticator, if so errors will be thrown when users cannot be found + * + * @return true if this is expected to be the only Authenticator + */ + public boolean isSingleAuthenticator() { + return false; + } + + /** + * Flag to test if this Authenticator is enabled + * + * @return true if the Authenticator is enabled + */ + public boolean isEnabled() { + return "true".equalsIgnoreCase(UtilProperties.getPropertyValue(props, "linked.authenticator.enabled", "true")); + } + + public static Document getUserInfo(GetMethod getMethod, Locale locale) throws HttpException, IOException, AuthenticatorException, SAXException, ParserConfigurationException { + Document userInfo = null; + HttpClient jsonClient = new HttpClient(); + HttpMethodParams params = new HttpMethodParams(); + params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); + getMethod.setParams(params); + jsonClient.executeMethod(getMethod); + if (getMethod.getStatusCode() == HttpStatus.SC_OK) { + Debug.logInfo("Json Response from LinkedIn: " + getMethod.getResponseBodyAsString(), module); + userInfo = UtilXml.readXmlDocument(getMethod.getResponseBodyAsString()); + } else { + String errMsg = UtilProperties.getMessage(resource, "GetOAuth2AccessTokenError", UtilMisc.toMap("error", getMethod.getResponseBodyAsString()), locale); + throw new AuthenticatorException(errMsg); + } + return userInfo; + } + + public static String getLinkedInUserId(Document userInfo) { + NodeList persons = userInfo.getElementsByTagName("person"); + if (UtilValidate.isEmpty(persons) || persons.getLength() <= 0) { + return null; + } + Element standardProfileRequest = UtilXml.firstChildElement((Element) persons.item(0), "site-standard-profile-request"); + Element url = UtilXml.firstChildElement(standardProfileRequest, "url"); + if (UtilValidate.isNotEmpty(url)) { + String urlContent = url.getTextContent(); + if (UtilValidate.isNotEmpty(urlContent)) { + String id = urlContent.substring(urlContent.indexOf("?id=")); + id = id.substring(0, id.indexOf("&")); + Debug.logInfo("LinkedIn user id: " + id, module); + return id; + } + } + return null; + } + + public static Map parseLinkedInUserInfo(Document userInfo) { + Map results = FastMap.newInstance(); + NodeList persons = userInfo.getElementsByTagName("person"); + if (UtilValidate.isEmpty(persons) || persons.getLength() <= 0) { + return results; + } + Element person = (Element) persons.item(0); + Element standardProfileRequest = UtilXml.firstChildElement(person, "site-standard-profile-request"); + Element url = UtilXml.firstChildElement(standardProfileRequest, "url"); + if (UtilValidate.isNotEmpty(url)) { + String urlContent = url.getTextContent(); + if (UtilValidate.isNotEmpty(urlContent)) { + String id = urlContent.substring(urlContent.indexOf("?id=")); + id = id.substring(0, id.indexOf("&")); + Debug.logInfo("LinkedIn user id: " + id, module); + results.put("userId", id); + } + } + Element firstNameElement = UtilXml.firstChildElement(person, "first-name"); + if (UtilValidate.isNotEmpty(firstNameElement) && UtilValidate.isNotEmpty(firstNameElement.getTextContent())) { + results.put("firstName", firstNameElement.getTextContent()); + } + Element lastNameElement = UtilXml.firstChildElement(person, "last-name"); + if (UtilValidate.isNotEmpty(lastNameElement) && UtilValidate.isNotEmpty(lastNameElement.getTextContent())) { + results.put("lastName", lastNameElement.getTextContent()); + } + Element emailElement = UtilXml.firstChildElement(person, "email-address"); + if (UtilValidate.isNotEmpty(emailElement) && UtilValidate.isNotEmpty(emailElement.getTextContent())) { + results.put("emailAddress", emailElement.getTextContent()); + } + return results; + } +} diff --git a/passport/src/org/ofbiz/passport/user/LinkedInUserGroupMapper.java b/passport/src/org/ofbiz/passport/user/LinkedInUserGroupMapper.java new file mode 100644 index 000000000..88eecd623 --- /dev/null +++ b/passport/src/org/ofbiz/passport/user/LinkedInUserGroupMapper.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.passport.user; + +import java.util.List; +import java.util.Properties; +import java.util.Arrays; +import java.util.Set; + +import org.ofbiz.base.util.UtilProperties; + +import javolution.util.FastList; +import javolution.util.FastSet; + +/** + * LinkedIn UserGroupMapper + */ +public class LinkedInUserGroupMapper { + + protected List groups; + + public LinkedInUserGroupMapper(String[] groups) { + this.groups = Arrays.asList(groups); + } + + public LinkedInUserGroupMapper(String group) { + if (groups == null) { + groups = FastList.newInstance(); + } + groups.add(group); + } + + public Set getSecurityGroups() { + Properties props = UtilProperties.getProperties(LinkedInAuthenticator.props); + + Set secGroups = FastSet.newInstance(); + boolean running = true; + int index = 1; + + while (running) { + String groupStr = (String) props.get("linkedin.group.map." + index); + if (groupStr == null) { + running = false; + } else { + String[] groupSplit = groupStr.split("="); + if (groupSplit.length == 2) { + if (groups.contains(groupSplit[0])) { + secGroups.add(groupSplit[1]); + } + } + } + index++; + } + return secGroups; + } +} diff --git a/passport/src/org/ofbiz/passport/util/PassportUtil.java b/passport/src/org/ofbiz/passport/util/PassportUtil.java new file mode 100644 index 000000000..cc9a72c58 --- /dev/null +++ b/passport/src/org/ofbiz/passport/util/PassportUtil.java @@ -0,0 +1,196 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.passport.util; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.Socket; +import java.net.UnknownHostException; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import javax.servlet.http.HttpServletRequest; + +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLContextBuilder; +import org.apache.http.conn.ssl.TrustSelfSignedStrategy; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.ofbiz.base.util.Debug; + +public class PassportUtil { + + public static final String module = PassportUtil.class.getName(); + + public static final String ClientIdLabel = "ClientId"; + + public static final String SecretLabel = "Secret"; + + public static final String ReturnUrlLabel = "ReturnUrl"; + + public static final String TokenEndpointLabel = "TokenEndpoint"; + + public static final String GrantTypeLabel = "grantType"; + + public static final String ContentTypeLabel = "contentType"; + + public static final String AUTHORIZATION_HEADER = "Authorization"; + + public static final String UserProfileUrlLabel = "UserProfileUrl"; + + public static final String GrantTypeParam = "grant_type"; + + public static final String ContentTypeParam = "Content-Type"; + + public static final String ACCEPT_HEADER = "Accept"; + + public static final String APPLICATION_JSON = "application/json"; + + public static final String RESTApiEndpointLabel = "RESTApiEndpoint"; + + public static final String COMMON_CODE = "code"; + + public static final String COMMON_SCOPE = "scope"; + + public static final String AuthorizationCodeGrantType = "authorization_code"; + + public static final String COMMON_STATE = "state"; + + public static final String COMMON_ERROR = "error"; + + public static final String COMMON_ERROR_DESCRIPTION = "error_description"; + + public static final String ApiKeyLabel = "apiKey"; + + public static final String SecretKeyLabel = "secretKey"; + + public static final String COMMON_CLIENT_ID = "clientId"; + + public static final String COMMON_RETURN_RUL = "returnUrl"; + + public static final String COMMON_CLIENT_SECRET = "clientSecret"; + + public static final String ApiIdLabel = "apiId"; + + public static final String AppKeyLabel = "appKey"; + + public static final String AppSecretLabel = "appSecret"; + + public static final String AppIdLabel = "appId"; + + public static final String COMMON_APP_KEY = "AppKey"; + + public static final String COMMON_APP_SECRET = "AppSecret"; + + protected PassportUtil() { + // empty constructor + } + + public static PassportUtil getInstance() { + return new PassportUtil(); + } + + public static String getEnvPrefixByHost(HttpServletRequest request) { + String prefix ="test"; + try { + InetAddress[] addresses = InetAddress.getAllByName(request.getServerName()); + for (InetAddress address : addresses) { + if (address.isAnyLocalAddress() || address.isLinkLocalAddress() || address.isLoopbackAddress()) { + return prefix; + } + } + prefix = "live"; + } catch (UnknownHostException e) { + Debug.logError(e.getMessage(), module); + } + return prefix; + } + + private static String randomString(int lo, int hi) { + int n = rand(lo, hi); + byte b[] = new byte[n]; + for (int i = 0; i < n; i++) { + b[i] = (byte)rand('a', 'z'); + } + return new String(b); + } + + private static int rand(int lo, int hi) { + java.util.Random rn = new java.util.Random(); + int n = hi - lo + 1; + int i = rn.nextInt() % n; + if (i < 0) + i = -i; + return lo + i; + } + + public static String randomString() { + return randomString(8, 15); + } + + public CloseableHttpClient getAllowAllHttpClient() { + try { + SSLContextBuilder builder = new SSLContextBuilder(); + builder.loadTrustMaterial(null, new TrustSelfSignedStrategy()); + SSLConnectionSocketFactory sf = new AllowAllSSLSocketFactory(builder.build()); + CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sf).build(); + return httpclient; + } catch (Exception e) { + return HttpClients.createDefault(); + } + } + + public class AllowAllSSLSocketFactory extends SSLConnectionSocketFactory { + SSLContext sslContext = SSLContext.getInstance("TLS"); + + public AllowAllSSLSocketFactory(SSLContext sslContext) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { + super(sslContext); + + TrustManager tm = new X509TrustManager() { + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return null; + } + }; + + sslContext.init(null, new TrustManager[] { tm }, null); + } + + public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException { + return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose); + } + + public Socket createSocket() throws IOException { + return sslContext.getSocketFactory().createSocket(); + } + } + +} \ No newline at end of file diff --git a/passport/webapp/passport/WEB-INF/actions/login/getThirdPartyLogins.groovy b/passport/webapp/passport/WEB-INF/actions/login/getThirdPartyLogins.groovy new file mode 100644 index 000000000..9dd863abe --- /dev/null +++ b/passport/webapp/passport/WEB-INF/actions/login/getThirdPartyLogins.groovy @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.ofbiz.passport; + +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.base.util.Debug; +import org.ofbiz.product.store.ProductStoreWorker; + +final String module = "getThirdPartyLogins.groovy" + +adminErrorInfo = context.adminErrorInfo; +productStoreId = context.productStoreId; +if (!productStoreId) { + productStore = ProductStoreWorker.getProductStore(request); + productStoreId = productStore.productStoreId; +} + +if (!adminErrorInfo || !adminErrorInfo.hasError()) { + storePassportLoginMethList = null; + // Get lists of passport login methods + if (productStoreId) { + storePassportLoginMethList = delegator.findByAnd("ThirdPartyLogin", ["productStoreId": productStoreId], ["sequenceNum ASC"], false); + storePassportLoginMethList = EntityUtil.filterByDate(storePassportLoginMethList); + } + + // Extra data preparation for each login method. + if (storePassportLoginMethList) { + storeLoginMethList = [] + for (storeLoginMeth in storePassportLoginMethList) { + storeLoginMethDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd(storeLoginMeth.loginMethTypeId + storeLoginMeth.loginProviderId, ["productStoreId": productStoreId], null, false))); + storeLoginMethList.add(storeLoginMethDetail) + } + context.storeLoginMethList = storeLoginMethList + } +} diff --git a/passport/webapp/passport/WEB-INF/controller-passport.xml b/passport/webapp/passport/WEB-INF/controller-passport.xml new file mode 100644 index 000000000..0c3ba584b --- /dev/null +++ b/passport/webapp/passport/WEB-INF/controller-passport.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/passport/webapp/passport/images/alipay.png b/passport/webapp/passport/images/alipay.png new file mode 100644 index 0000000000000000000000000000000000000000..79f3ead564832fba015d29da3b3f59effff195b8 GIT binary patch literal 4412 zcmZ`+2UHVlw+$^cL2Bp_LluEQXp)2umr$fv0qH0$fe;XgC`G9%f=VwxNRwjdz1ILz zZ3t3C5s|922mv16_TP8cd$ZQeoY~(#dw=JgS+mx}n;PpeG4L_~001U^l#cn?9rEj> z1D;*sdW<~)0JVshwzjFhwl>%li}CdG^#A}av);2>z|2~5sKs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9L*^ivVFkfoeedkLgp_!&Gf1Bed^;ALZDy0{k5|dW72+LTKeO_St#2IG5H#}%$dhNl;{6Ju@ z5dWCW=w1w@#c7{I=v5+TncH1uxf6wqH2(-GlJO zXyvhzO*s-Nq__=(rutMQY8NijTycNu<5mA-ivGgS?Etp^ZyPm)ZQG~g2LVuDn zk36e5zR`5>RdGbJHHXXhadr{$%9N#vD3dfWDuF&kL?*M>YmNoQ|I=%sM=L6?aIj&k z)~Xik@rKh;^_Z43Ua4^%-%k=yz^gpQB> zA&_b%CtZS6=k3*)%*;%R`8;hBzTBFo6%M~6cR8hFj7=4lqAC{o^1bM@wE2bOFK})j z7gPmzr$=*G_t@=)sY0pH1_gKpwj{ z=QpKRzh3U}kx+u!4}3Q{{@J0bc3P(vqW*P~7@?kwl0g;9+w|O{0<`f=e#B~cGRMo$ zPu1X$#F*37#{z|Hg+8d6RFq=sRozchF;3SeUL9F#iq&urnt(^Cvsl3_Jr?)0suuIp z?tCzOiP);Vh`^CLnI^w(7g$0l_^GfAm&H00ljBO4beK!->*#AST$od{I(|Qk=^z1D zjDg)pzLcNP=og$(cs;A5trotHt@v9Fp<%@(mWF%1?V{hDY3|Z;K5~^VOt<>1F1;5m zC?4AUto$amVcmU$1gGGzWWznMRgiG3wrc`JaQ`UV#G%%CGU>#;bD3qD&E$0ZZKb_m zliTc_Yt+#dzK)e|9BlMQqSh)>7R!Xk@p`#Cf=fmLf@sAh^{L+ zv1*$cIxXk@sP6Bwxf|os(Ot9`u|W^Vk0gWe=#3Q{U7zEa_ouWRlESYdvMsrO P{jccj8tc5!a*p~REYR_a literal 0 HcmV?d00001 diff --git a/passport/webapp/passport/images/github.png b/passport/webapp/passport/images/github.png new file mode 100644 index 0000000000000000000000000000000000000000..6b1a421df3fe5aa0bd80ca11a618a6bde06465f8 GIT binary patch literal 2323 zcmV+u3GDWXP)4Tx05}naRo`#hR1`jmZ&IWdKOk5~hl<6oRa0BJ8yc;~21%2p?MfD<>DVeH z9(p*dx19w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J#jWF5 z(;dCL_O|?OBkD}k-X_0SuhW~&-GI9@36F0FS*aKPYs&Iy4ub0uq7n0kFFqwzjU%M9 zfG5NDNb16MJuA>u+k<;$ShqiB{R#8jXQngYy3dNdnCMeIKJt@(jV(?8g;8UigjkKb z!`8UK&eI;vj!F+sY`)p%zD!C-ytnT4&&K0r&5IVCA=EX2G_Ser%OC=xUO$(bXsz2F z8^bb}7nEi^IPrD8YhGq@Z~S;2x9I8Bf4Y`b9~zLqfVjYrR_)JXw?~2|k6uyFoL|Eo dHm@-UtY8nAz|*N);NM?xRV7WuN_mUW{{s`2uFn7f literal 0 HcmV?d00001 diff --git a/passport/webapp/passport/images/qq.png b/passport/webapp/passport/images/qq.png new file mode 100644 index 0000000000000000000000000000000000000000..47effa1dd95d439c605a4a9be85aaff4bcb580ee GIT binary patch literal 4802 zcmZ`+1yCH@wjFG6*Pw&D6J*c?cefB+2WJ>yu!JE5*C4@y=K_PfLy!O$2u{#o!3i*g zAOS)?x%TdV^?z4&_wLneuXXm>r%qSL=;^2u;?d#(002UDH6?@lJIk*V2Y7!4tK#M4u3mN!-1#g*P~KvQoGW-R?AAV){v&`2gcDE71eJh*wRx=snYVaW2YNt zH8Ex@_I3DEMn8}V^ip1qA8s(j;*1`p9N+0&u=WJStxUzR=)Uu$WC(q5MW8=6>(;DE z(Sv<+1!)1UoYA9Z#4*t;&|ind2#BO3wc@{RIZ330#ox1Pkr}>6a~M4eXkW->L2?DY5EM@!QRn zYe<*q<%y&Xbg78Tu!{^wyzC#f6=u<$CUgH3D3$biC?dX|x{JR^|E=^;jd#!Qb!PI0 zi)gn@b`4*I=$y$*Y9$tOzTjx~f_sUu@Sq-GN}iceuJf}_T|Xl#u#Vo>TZK@rX#MfU z6WZ$!Nq3RiwVJ%&Sam0b#Vn4A57L$7u7$t8oOy5hG7-w~6n z9KG_xa%0nN8GV3zx*)?g`hzHWYv4!%4^8Vloq0UI~7WH=8ZRc&h3|%cnn>Ax<=~fr&3+}}S zf*%Z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mfjtl z?;YSOq$z`invy>jXilB+(i2I$A*;0uaQ#&gVsrDQ?t0yI4qsrfUO-W zGu8oO*U9D+e6Py1Kb=KZqfA zo~5%q#y9t<&5P41{NPvYq8HN~5nhTSR2k-zWoM4BPV|2$?Mz}Q7RnP8)UN-mTZ=lC z%6<;0;_Tz-*uCxP*0HwH7@)(KIcsceEVVJyg}s|E9Z2?_SeC#`kpV3K44X=$RSdLQ zKrp~o>hk$Uk}{MTFrNwmV{*5n+cMsfBoxfFUp!$Kux@`hmM>vCKFaj$+rX4y1>K=* zJCfF(;Wf-TIqSdoiyyBY? zuzVi-O{dc!v^RQbY2UENZO=$>&JVeLE_;wjd|93`5OOYUPGFS+#x-JD#N4K$@-L_DJ536 zuxOGL-s&{_8O`Sd?RBQLTpbK}rs=+$5&VUf3 zRu*G>x-RHL?m)3lV+txNw3Srk@mro<9QkZvJP;WvJTm1TkT9DWStIX$0Hx_^&00@% z>5z4=;po#^$(Dkhk%jjNDin%ubEXUd z14_*z(zO?lGd%enp3_I?`wqfGyU|>DF}8oQxvGqDP1`?-Bq|-Jf1jnOs(;-^2>trP zX6CDHjBa@1F+X%t(fkR2=AdY8(1>s<(N(yr`M}nUj~z8)koL)iLNux9!a{@#_9NnTDk$GPgGpEspwq4`#y>W_X; zj9dyRL5dKhg?fvi6R`ax)p#JyEp;GbxRjO|gJ~+BtHZhdo)4X3=}4P!-NM!8vWXcn zt(Bw0;aKPu&&Uu@Sy)29^~3$3JLNNnSEh`eHzdEe0}XPf^whG;vgh<$P#y&0sUox< zrPU%){CmVz1VT+qBSKc33fRTm&i~|_%WHuu-DH3t3|8>wcwk9V+p$U0?CA=?VRy$h mcWJYB=m+h@+mpvkYlMs;N!rRv8v;r|0o2)Gdd literal 0 HcmV?d00001 diff --git a/passport/webapp/passport/images/renren.png b/passport/webapp/passport/images/renren.png new file mode 100644 index 0000000000000000000000000000000000000000..0c14aa04748a5b83db43a4062aa7a85ce6790c8f GIT binary patch literal 4284 zcmZ`+2T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Uy^vrzC~@}M`ut3Rt$Xl-GRivRSZN$}UfgU+#4Er< zg95RF86G*TXn&wqcY1!_Ww==Xc_h50{L(}YioQPTfV6mBqy>)nUB{d`tT-o(TF~Hi z-l$z&5^e`4-Bi1VC20&MB4{rd^#jz{<=B}zIf1l#8A<(|PxHLbx7FyN{`xydGPWAT VQl-taCBJ_Ys62rwl*?HL{SRjT+4cYc literal 0 HcmV?d00001 diff --git a/passport/webapp/passport/images/weibo.png b/passport/webapp/passport/images/weibo.png new file mode 100644 index 0000000000000000000000000000000000000000..b62110b68fc4dd2df6bc7ab16359d92504d67c1c GIT binary patch literal 4726 zcmZ`+2UHVXw+%=~LFrXu=)JcPIs&2hA|N8o03ifIGlU{df^-yu6h%4`P!I&^(tA@W z(u+tDL;@)7;n)7}{p-D1Yi7>uyU*VD+;i8gnK%<8ohwvqQ~&_r3RG9i?BWjkeNvEJ zT){fj?EnA?4@^_j1gfbCH1S2a!Mt1n0EKJOmh*@i3kH=qgjoTTD$qtJ7TZ~AX>M1~ z&Q{Sy22Cs6)?+ICIw{1n0+x>}WhbBcT3cp}j*uriAyS*VM5_zAafR$Idg`FH25KHF zR0h>WuXoVi;M*p(TznUBm*2d@p75(*abEF@(wEyaTFQ>FH(9Kf51*9dbB1{yrxi1$ z=Ne+iswea>O_YB%5>4qJq!VjnJRI6wM}aGdkdIxgY;|G!A6k>dnZBVLiHR zIxyi`tIyCvetZP0Bm4Y=V|QGRgt(kI1Cvb`G}_ItY;;4FGI2y`ld*!Lkqpu}=_X$1 zf}4TD4v9@lRT#td+NWxx_~)+$LgqN(s@0lq{ke#;Iz=DhbhB3W+AQCqGtQ6Z{Y@rxszO4 ziU(K1$-`A^DjG{j2gktj()mn#`qrM__)_(0e3q>#^{Et2>2^|&ApG6q_H?d(nudVq zto=-SU87(5!YbVEyI-50Bz>35Je{03JGO-)V+o#AZ3K(2k#Wp8OqkuRebK73uBF9o z#3Xw6L#dupfl01ZdPkGC9E4Y@Co1}Vzmp`$c#O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ff --git a/passport/widget/PassportScreens.xml b/passport/widget/PassportScreens.xml new file mode 100644 index 000000000..13016302a --- /dev/null +++ b/passport/widget/PassportScreens.xml @@ -0,0 +1,42 @@ + + + + + + + + +
+ + +