Package org.butor.sso

Examples of org.butor.sso.SSOInfo


    }
  }

  private SSOInfo parseReply(PostMethod m) throws IOException {
    String pl = m.getResponseBodyAsString();
    SSOInfo sos = jsh.deserialize(pl, DefaultSSOInfo.class);
    return sos;
  }
View Full Code Here


    }
    */

    HttpSession session = request.getSession();
    String ssoId = SSOHelper.getCookie(request, SSOConstants.SSO_SSO_ID);
    SSOInfo ssoInfo = null;
    if (ssoId != null) {
      if (_logger.isDebugEnabled())
        _logger.debug(String.format("Got ssoId=%s", ssoId));

      try {
        ssoInfo = _validator.validate(ssoId);
      } catch (SSOException e) {
        _logger.warn("Failed", e);
      }
    }

    if (ssoInfo != null) {
      if (_logger.isDebugEnabled())
        _logger.info(String.format("Valid ssoId=%s, id=%s", ssoId, ssoInfo.getId()));

      if (session == null || session.getAttribute(SSOConstants.SSO_ID) == null || session.getAttribute(SSOConstants.SSO_SSO_ID) == null) {
        session = request.getSession(true);
        session.setAttribute(SSOConstants.SSO_SSO_ID, ssoId);
        session.setAttribute(SSOConstants.SSO_ID, ssoInfo.getId());

        // set cookie
        SSOHelper.setCookie(response, SSOConstants.SSO_SSO_ID, ssoId, -1, "/");
      }

    } else {
      if (ssoId != null) {
        //remove cookie
        SSOHelper.removeCookie(response, SSOConstants.SSO_SSO_ID, "/");
      }
      if (session != null && session.getAttribute(SSOConstants.SSO_SSO_ID) != null) {
        session.removeAttribute(SSOConstants.SSO_ID);
        session.removeAttribute(SSOConstants.SSO_SSO_ID);
        session.invalidate();
      }
      if (_blocking) {
        String sp = request.getParameter("streaming");
        boolean ajaxCall = (sp != null &&
            request.getParameter("service") != null &&
                request.getParameter("reqId") != null);
        boolean streaming = sp != null && sp.equals("true");
        _logger.info(String.format("Invalid ssoId=%s. redirected to login (blocking filter config)", ssoId));
        if (ajaxCall) {
          if (!streaming) {
            String reqId = request.getParameter("reqId");
            byte[] bb = ("{\"reqId\":\"" +reqId +"\",\"data\":[],\"messages\":[{\"id\":\"SESSION_TIMEDOUT\",\"sysId\":\"common\",\"type\":\"ERROR\"}]}").getBytes();
            resp_.getOutputStream().write(bb);
          } else {
            String url = sessionTimeoutStreamingUrl +"?ts=" +System.currentTimeMillis();
            response.sendRedirect(url);
          }
        } else {
          String url = sessionTimeoutUrl +"?ts=" +System.currentTimeMillis();
          response.sendRedirect(url);
        }
        return;

      } else if (ssoId != null) {
        _logger.info(String.format("Invalid ssoId=%s. Invalidated session and let pass. (non blocking filter config)", ssoId));
      }
    }

    PrincipalServletRequestWrapper srw = new PrincipalServletRequestWrapper(request, ssoInfo.getId());
    filterChain_.doFilter(srw, resp_);
  }
View Full Code Here

    }
  }

  private SSOInfo parseReply(PostMethod m) throws IOException {
    String pl = m.getResponseBodyAsString();
    SSOInfo sos = jsh.deserialize(pl, DefaultSSOInfo.class);
    return sos;
  }
View Full Code Here

TOP

Related Classes of org.butor.sso.SSOInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.