/** * 已绑定用户key登录 * * @param key * @param request * @param response * @param model */ private void loginByKey( String key, HttpServletRequest request, HttpServletResponse response, ModelMap model) { CmsThirdAccount account = accountMng.findByKey(key); if (StringUtils.isNotBlank(key) && account != null) { String username = account.getUsername(); loginShiro(request, response, username); } }
private void bind(String username, String openId, String source) { CmsThirdAccount account = accountMng.findByKey(openId); if (account == null) { account = new CmsThirdAccount(); account.setUsername(username); // 第三方账号唯一码加密存储 防冒名登录 openId = pwdEncoder.encodePassword(openId); account.setAccountKey(openId); account.setSource(source); accountMng.save(account); } }