Пример #1
0
 @Override
 protected Map<String, String> getInfoMap(PtSessionBean ssoInfo) {
   Map<String, String> infoMap = new HashMap<String, String>();
   infoMap.put(USERID, ssoInfo.getPk_user());
   infoMap.put(GROUPNO, ssoInfo.getGroupNo());
   return infoMap;
 }
Пример #2
0
 @Override
 public void addSsoSign(PtSessionBean sesbean, String sysid) {
   HttpServletRequest request = LfwRuntimeEnvironment.getWebContext().getRequest();
   HttpSession session = request.getSession();
   session.setAttribute(SessionConstant.LOGIN_SESSION_BEAN, sesbean);
   LfwRuntimeEnvironment.setLfwSessionBean(sesbean);
   LfwRuntimeEnvironment.setDatasource(sesbean.getDatasource());
   String sesid = session.getId();
   // 创建一个token
   LfwTokenVO token = new LfwTokenVO();
   token.setDatasource(sesbean.getDatasource());
   token.setPkcrop(sesbean.getPk_unit());
   token.setUsername(sesbean.getUser_name());
   token.setSessionid(sesid);
   token.setUserpk(sesbean.getPk_user());
   token.setThemeid(sesbean.getThemeId());
   token.setUsertype(String.valueOf(sesbean.getUserType()));
   token.setPasswd(sesbean.getUser().getPassword());
   token.setUserid(sesbean.getUser_code());
   token.setLoginip(request.getRemoteAddr());
   token.setSessionid(sesid);
   token.setSystemid(sysid);
   token.setExt1(LfwRuntimeEnvironment.getRootPath());
   //			token.setAccountcode(sesbean.getAccount());
   token.setLogindate(new UFDateTime(System.currentTimeMillis()));
   String uuid = UUID.randomUUID().toString();
   token.setTokenid(uuid);
   ILfwSsoService ssoService = NCLocator.getInstance().lookup(ILfwSsoService.class);
   try {
     ssoService.createToken(token);
     // Token编号设置到session bean中
     // 设置根Token编号
     session.setAttribute(SessionConstant.ROOT_TOKEN_ID, LfwSsoUtil.getTokenID());
     sesbean.setSsotoken(uuid);
   } catch (LfwBusinessException e) {
     LfwLogger.error("单点登陆信息注册失败", e);
   }
 }