예제 #1
0
 public void afterLogin(LfwSessionBean sbean) {
   PtSessionBean ptBean = (PtSessionBean) sbean;
   IUserVO userVO = (IUserVO) ptBean.getUser();
   try {
     /** License检查 */
     // checkLicense(userVO.getPk_user(), userVO.getPassword());
     /** 初始化用户信息 */
     initUser(ptBean);
     UFBoolean loginResult = UFBoolean.TRUE;
     doLoginLog(sbean, loginResult);
   } catch (Exception e) {
     LfwLogger.error(e.getMessage(), e);
     throw new LfwRuntimeException(e.getMessage());
   }
 }
예제 #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);
   }
 }