@Override public org.activiti.engine.identity.User handlerUserAuthorize(Map map) { OAuthV2 oAuth = (OAuthV2) map.get("oAuth"); JSONObject userInfo = (JSONObject) map.get("user"); org.activiti.engine.identity.User retUser = null; try { SocialUserAccountQuery query = getQuery(userInfo); List<SocialUserAccount> list = socialUserAccountService.findSocialUserAccountByQueryCriteria(query, null); if (list != null && list.size() > 0) { SocialUserAccount c = list.get(0); retUser = updateSocialInfo(c, userInfo, oAuth); } else { // retUser = addSocialInfo(userInfo, oAuth); } } catch (Exception e) { throw new ApplicationException(e.getMessage()); } return retUser; }