Package com.adito.policyframework

Examples of com.adito.policyframework.ResourceAccessEvent


    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,
View Full Code Here


       
        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);
       
View Full Code Here

      VariableReplacement r = new VariableReplacement();
      r.setServletRequest(request);
      r.setLaunchSession(launchSession);
      url = r.replace(url);

      CoreEvent evt = new ResourceAccessEvent(this,
                            WebForwardEventConstants.WEB_FORWARD_STARTED,
              wf,
              launchSession.getPolicy(),
              launchSession.getSession(),
              CoreEvent.STATE_SUCCESSFUL).addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
        ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(wf.getType())).getName())
              .addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL, url);

      CoreServlet.getServlet().fireCoreEvent(evt);

      // Get the URL to redirect to
      if (wf.getActiveDNS()) {
        URL u = new URL(url);
        URL adu;
        if (Property.getPropertyInt(new SystemConfigKey("webforward.activeDNSFormat")) == 1) {
          adu = new URL("https", launchSession.getId() + "." + hostService.getHost(), hostService.getPort() == 0 ? -1
            : hostService.getPort(), u.getFile());
        } else {
          int idx = hostService.getHost().indexOf('.');
          adu = new URL("https",
                  launchSession.getId() + "." + hostService.getHost().substring(idx + 1),
                  hostService.getPort() == 0 ? -1 : hostService.getPort(),
                  u.getFile());
        }
        path = adu.toExternalForm();

      } else if (wf.getHostHeader() != null && !wf.getHostHeader().equals("")) {
        URL u = new URL(url);

        URL adu = new URL("https", wf.getHostHeader(), hostService.getPort() == 0 ? -1 : hostService.getPort(), u.getFile());

        path = adu.toExternalForm();

        if (adu.getQuery() == null || adu.getQuery().equals("")) {
          path += "?" + LaunchSession.LAUNCH_ID + "=" + launchSession.getId();
        } else {
          path += "&" + LaunchSession.LAUNCH_ID + "=" + launchSession.getId();
        }

        /**
         * Why do we need to use a JSP redirect? Because the new host
         * will be created in a new session and we need the JSESSIONID
         * which is only set once the first response has been returned
         * to the browser. This redirect allows the browser to load a
         * page on the new host and set the session cookie before an
         * automatic redirect takes the user to the correct reverse
         * proxy page.
         */
        URL adu2 = new URL("https",
            /**
             * LDP Not sure why this was using hostService.getHost because my comment above
             * clearly indicates that we have to redirect from the new host
             */
            wf.getHostHeader(),
            hostService.getPort() == 0 ? -1 : hostService.getPort(),
            "/reverseProxyRedirect.jsp?redirectURL=" + Util.urlEncode(path));

        return new ActionForward(adu2.toExternalForm(), true);

      } else {
        URL u = new URL(url);
        path = u.getPath();
        if (u.getQuery() == null || u.getQuery().equals("")) {
          path += "?" + LaunchSession.LONG_LAUNCH_ID + "=" + launchSession.getId();
        } else {
          path += "?" + u.getQuery() + "&" + LaunchSession.LONG_LAUNCH_ID + "=" + launchSession.getId();
        }
       
        URL redir = new URL("https",
          hostService.getHost(),
          hostService.getPort() == 0 ? -1 : hostService.getPort(),
          path);
        path = redir.toExternalForm();
      }
    } catch (NoPermissionException npe) {

      CoreEvent evt = new ResourceAccessEvent(this,
                            WebForwardEventConstants.WEB_FORWARD_STARTED,
              wf,
              launchSession.getPolicy(),
              launchSession.getSession(),
              npe).addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
View Full Code Here

        mapping,
        launchSession,
        returnTo,
        request);

      CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this,
          ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED,
              launchSession.getResource(),
              launchSession.getPolicy(),
              launchSession.getSession(),
              CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME,
        descriptor.getName()).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, descriptor.getId()));

      /*
       * If the launch implementation returns its own forward, it is
       * reponsible for setting up its 'launched' message
       */
      if (fwd == null) {
        ActionMessages msgs = new ActionMessages();
        msgs.add(Globals.MESSAGE_KEY, new BundleActionMessage(ApplicationsPlugin.MESSAGE_RESOURCES_KEY,
                "launchApplication.launched",
                shortcut.getResourceName()));
        saveMessages(request, msgs);
        return new RedirectWithMessages(returnTo, request);
      }
      return fwd;
    } catch (Exception ex) {
      CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this,
          ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED,
              launchSession.getSession(),
              ex).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME, descriptor.getName())
              .addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, descriptor.getId()));
      throw ex;
View Full Code Here

            } else {
                throw new TunnelException(TunnelException.INTERNAL_ERROR, (Throwable)null, "Unknown tunnel type " + tunnel.getType());
            }

            CoreServlet.getServlet().fireCoreEvent(
                            new ResourceAccessEvent(this, TunnelsEventConstants.TUNNEL_CLOSED, launchSession.getResource(),
                                            launchSession.getPolicy(), launchSession.getSession(), CoreEvent.STATE_SUCCESSFUL));

        } catch (TunnelException te) {
            CoreServlet.getServlet().fireCoreEvent(
                            new ResourceAccessEvent(this, TunnelsEventConstants.TUNNEL_CLOSED, launchSession.getResource(),
                                            launchSession.getPolicy(), launchSession.getSession(), te));
            throw te;
        } finally {
      LaunchSessionFactory.getInstance().removeLaunchSession(launchSession);
        }
View Full Code Here

                    throw new TunnelException(TunnelException.INTERNAL_ERROR, (Throwable)null, "Unknown tunnel type " + tunnel.getType());
                }

                // Fire event
                CoreServlet.getServlet().fireCoreEvent(
                                new ResourceAccessEvent(this, TunnelsEventConstants.TUNNEL_OPENED, launchSession.getResource(),
                                                launchSession.getPolicy(), launchSession.getSession(), CoreEvent.STATE_SUCCESSFUL));
            } catch (TunnelException te) {

                // Fire event
                CoreServlet.getServlet().fireCoreEvent(
                                new ResourceAccessEvent(this, TunnelsEventConstants.TUNNEL_OPENED, launchSession.getResource(),
                                                launchSession.getPolicy(), launchSession.getSession(), te));

                throw te;
            }
        }
View Full Code Here

          null,
          launchSession,
          null,
          null);

        CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this,
                ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED,
                launchSession.getResource(),
                launchSession.getPolicy(),
                launchSession.getSession(),
                CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME,
          descriptor.getName()).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, descriptor.getId()));

      } catch (Exception ex) {
        CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this,
            ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED,
                launchSession.getSession(),
                ex).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME, descriptor.getName())
                .addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, descriptor.getId()));
        throw ex;
View Full Code Here

          ExtensionDescriptor descriptor = ExtensionStore.getInstance().getExtensionDescriptor(shortcut.getApplication());

          Request newRequest = launchApplication(launchSession);
          request.setRequestData(newRequest.getRequestData());

          CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this,
              ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED,
                  launchSession.getResource(),
                  launchSession.getPolicy(),
                  launchSession.getSession(),
                  CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME,
View Full Code Here

        PrintWriter pw = new PrintWriter(new OutputStreamWriter(out));
        pw.print(processed);
        pw.flush();

        Policy pol = PolicyDatabaseFactory.getInstance().getGrantingPolicyForUser(launchSession.getSession().getUser(), shortcut);
        CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this, ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED, shortcut, pol, launchSession.getSession(), CoreEvent.STATE_SUCCESSFUL)
        .addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME, app.getName())
        .addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, shortcut.getApplication()));
        //////////////////////////////////////////////
       
        return null;
View Full Code Here

TOP

Related Classes of com.adito.policyframework.ResourceAccessEvent

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.