Package com.adito.policyframework

Examples of com.adito.policyframework.LaunchSession


   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward onExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
          throws Exception {
    // Setup the Replacement proxy
    LaunchSession launchSession = LaunchSessionFactory.getInstance()
            .getLaunchSession(request.getParameter(LaunchSession.LAUNCH_ID));
    launchSession.checkAccessRights(null, getSessionInfo(request));
    ReplacementProxyWebForward f = (ReplacementProxyWebForward) launchSession.getResource();

    VariableReplacement r = new VariableReplacement();
    r.setServletRequest(request);
    r.setLaunchSession(launchSession);
    String destinationURL = r.replace(f.getDestinationURL());

    CoreEvent evt = new ResourceAccessEvent(this,
                        WebForwardEventConstants.WEB_FORWARD_STARTED,
            f,
            launchSession.getPolicy(),
            this.getSessionInfo(request),
            CoreEvent.STATE_SUCCESSFUL).addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
      ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(f.getType())).getName())
            .addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL, destinationURL);

    CoreServlet.getServlet().fireCoreEvent(evt);

    response.sendRedirect("/replacementProxyEngine?" + LaunchSession.LONG_LAUNCH_ID
      + "="
      + launchSession.getId()
      + "&sslex_url="
      + Util.urlEncode(destinationURL));
    return null;
  }
View Full Code Here


        String launchId = request.getParameter(LaunchSession.LAUNCH_ID);
        if (Util.isNullOrTrimmedBlank(launchId)) {
            throw new Exception("No launch ID supplied.");
        }
       
        LaunchSession launchSession = LaunchSessionFactory.getInstance().getLaunchSession(launchId);
        launchSession.checkAccessRights(null, getSessionInfo(request));
        WebForward wf = (WebForward)launchSession.getResource();

        CoreEvent evt = new ResourceAccessEvent(this, WebForwardEventConstants.WEB_FORWARD_STARTED, wf, launchSession.getPolicy(), launchSession.getSession(),
                        CoreEvent.STATE_SUCCESSFUL).addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL,
            wf.getDestinationURL()).addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
            ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(wf.getType())).getName());
        CoreServlet.getServlet().fireCoreEvent(evt);
       
        VariableReplacement replacer = new VariableReplacement();
        replacer.setLaunchSession(launchSession);
        URL url = new URL(replacer.replace(wf.getDestinationURL()));
        MultiplexedConnection agent = DefaultAgentManager.getInstance().getAgentBySession(getSessionInfo(request));
        int port = DefaultAgentManager.getInstance().openURL((AgentTunnel)agent, url, launchSession);
        if(port == -1) {
          throw new Exception("Agent couldn't open tunnel.");
        }
       
        // BPS to LDP - We have to wait for the serversocket on the agent end to startup
        // as it is in a thread. Is there a better way of doing this?
        Thread.sleep(1000);
       
        return new ActionForward(url.getProtocol() + "://" + Property.getProperty(new ProfilePropertyKey("client.localhostAddress", launchSession.getSession())) + ":" + port + url.getFile(), true);
    }
View Full Code Here

        Policy policy = LaunchSessionManager.getLaunchRequestPolicy(null, agent.getSession(), resource);
        if (resource.sessionPasswordRequired(agent.getSession())) {
          // TODO: prompt user for credentials through agent!
          return true;
        } else {
          LaunchSession launchSession = LaunchSessionFactory.getInstance().createLaunchSession(agent.getSession(),
            resource,
            policy);
          launchSession.checkAccessRights(null, agent.getSession());
                    String uri = resource.getLaunchUri(launchSession);
                    ByteArrayWriter baw = new ByteArrayWriter();
                    baw.writeString(uri);
                    request.setRequestData(baw.toByteArray());
                  return true;
View Full Code Here

    }
   
    if(session==null) {
      // LDP - Fallback position, if no session check for a launchId parameter.
      // WARNING - this may break web forward encoding!!
      LaunchSession ls = LaunchSessionFactory.getInstance().getLaunchSession((String)request.getParameters().get("launchId"));
      if(ls!=null) {
        session = ls.getSession();
        LogonControllerFactory.getInstance().attachSession(sessionId, session);
      }
    }

    return session;
View Full Code Here

  public boolean handle(String pathInContext, String pathParams, RequestHandlerRequest request, RequestHandlerResponse response)
          throws RequestHandlerException, IOException {
    if (log.isDebugEnabled())
      log.debug("Checking for Replacement proxy request: " + pathInContext);
   
    LaunchSession launchSession = null;
   
    String launchId;

    try {
      String requestPath = request.getPath();
      if (requestPath.startsWith("/replacementProxyEngine")) {


        /* The launch session and URL may be provided in one of two ways.
         *
         * 1. As a request to /replacementProxyEngine with the launch session
         *    and target URL provided as sslx_launchId and sslx_url respectively
         *   
         * 2. In the new format /replacementProxyEngine/[launchId]/[encodedURL]
         */
       
        if(requestPath.startsWith("/replacementProxyEngine/")) {
          int idx = requestPath.indexOf('/', 1);
          int idx2 = requestPath.indexOf('/', idx + 1);
          launchId = requestPath.substring(idx + 1, idx2);
        }
        else {
          launchId = (String) request.getParameters().get(LaunchSession.LONG_LAUNCH_ID);
        }
       
        if (launchId != null) {
          LaunchSession foundLaunchSession = LaunchSessionFactory.getInstance().getLaunchSession(launchId);
          if (foundLaunchSession == null) {
            response.sendError(404, "Invalid launch session. Your login session has probobably timed out.");
            return true;
          }
          if (foundLaunchSession.isTracked() && foundLaunchSession.getResource()
                  .getResourceType()
                  .equals(WebForwardPlugin.WEBFORWARD_RESOURCE_TYPE)) {
            launchSession = foundLaunchSession;
            if (log.isDebugEnabled()) {
              log.debug("Found a web forward launch session provided by " + LaunchSession.LONG_LAUNCH_ID
View Full Code Here

    /*
     * First try and locate the session, if there is no session then this is
     * definitely not a reverse proxy request
     */
    LaunchSession launchSession = null;
    SessionInfo session = locateSession(request, response);

    if (session == null) {
      // If we have no session, then this cannot be a reverse proxy
      // request
      if (log.isDebugEnabled())
        log.debug("No session, not a reverse proxy.");
      return false;
    }
   
    try {
      // Perhaps this is a reverse proxy?
      String host = request.getHost();
      ReverseProxyWebForward wf = null;

      // Active Proxy

      if (host != null && !host.equals("") && host.indexOf('.') > -1) {
        int idx = host.indexOf('.');
        if (idx != -1) {
          try {
            String uniqueId = host.substring(0, idx);
            launchSession = LaunchSessionFactory.getInstance().getLaunchSession(session, uniqueId);
            if (launchSession != null) {
              wf = (ReverseProxyWebForward) launchSession.getResource();
              launchSession.checkAccessRights(null, session);
              if (!((ReverseProxyWebForward) wf).getActiveDNS()) {
                throw new Exception("Appears to be an active DNS request but the associated web forward is not active DNS. Is someone trying something funny???");
              }
                          LogonControllerFactory.getInstance().addCookies(request, response, session.getLogonTicket(), session);
              return handleReverseProxy(pathInContext, pathParams, request, response, launchSession);
View Full Code Here

     */
    if (request.getMethod().equals("GET") && request.getParameters().containsKey(LaunchSession.LONG_LAUNCH_ID)) {
      String launchId = (String) request.getParameters().get(LaunchSession.LONG_LAUNCH_ID);

      // Get the actual session for the reverse proxy
      LaunchSession launchSession = LaunchSessionFactory.getInstance().getLaunchSession(launchId);
      if (launchSession != null) {

        // If the launch session is not for a reverse proxy web forward
        // then ignore
        if (launchSession.isTracked() && launchSession.getResource() instanceof ReverseProxyWebForward) {
          session = launchSession.getSession();

          Cookie[] cookies = request.getCookies();
          if (cookies != null) {
            for (int i = 0; i < cookies.length; i++) {
              if (cookies[i].getName().equalsIgnoreCase(sessionCookie)) {
View Full Code Here

            String path = transaction.getPath();
            if (log.isDebugEnabled())
                log.debug("Looking for resource for '" + path + "'");

            // Get the best launch session possible
            LaunchSession launchSession = null;
            String launchId = transaction.getRequest().getParameter(LaunchSession.LAUNCH_ID);
            if (launchId != null) {
                launchSession = LaunchSessionFactory.getInstance().getLaunchSession(launchId);
            }
           
            /* If there is no specified launch session, create one. We can make it
             * a tracked session later if the mount requires it
             */
            if(launchSession == null) {
                /* The session needn't be available for mounts that don't need
                 * Adito Authorization
                 */
                launchSession = new LaunchSession(transaction.getSessionInfo());
            }
           

            /* Get the resource. The launch session may be converted to a tracked session
             * at this point
View Full Code Here

    }

    class AbstractStoreResource extends AbstractVFSResource {

        AbstractStoreResource(String name, VFSRepository repository) throws URISyntaxException {
            super(new LaunchSession(getRepository().getSession()), new URI(name), true, name, repository.getRepositoryResource(), AbstractStore.this.repository);
        }
View Full Code Here

    }
   
    class MountVFSResource extends AbstractVFSResource {

    MountVFSResource(String mountName, VFSResource parent) throws URISyntaxException {
      super(new LaunchSession(getRepository().getSession()), new URI(DAVUtilities.encodePath(mountName)), true, mountName, parent, AbstractStore.this.repository);
    }
View Full Code Here

TOP

Related Classes of com.adito.policyframework.LaunchSession

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.