Package com.adito.core

Examples of com.adito.core.CoreEvent


      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


                }
            }
            else {
                publicKeyStore.removeCachedKeys(user.getPrincipalName());
            }
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this,
                            CoreEventConstants.CHANGE_PASSWORD,
                            null,
                            info,
                            CoreEvent.STATE_SUCCESSFUL));
            request.getSession().removeAttribute(Constants.PASSWORD_CHANGE_REASON_MESSAGE);
            GlobalWarningManager.getInstance().removeGlobalWarning(request.getSession(), "globalWarning.passwordNearExpiry");
            CoreUtil.removePageInterceptListener(request.getSession(), "changePassword");           
        } catch (InvalidLoginCredentialsException e) {
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.CHANGE_PASSWORD, null, info, e));

            ActionMessages errors = new ActionMessages();
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("security.cannotChangePassword", e.getMessage()));
            saveErrors(request, errors);
            return mapping.findForward("failure");
           
        } catch (PasswordChangeTooSoonException e) {
          CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.CHANGE_PASSWORD, null, info, e));
            Date requiredData = ((PasswordChangeTooSoonException) e).getRequiredDate();
            saveError(request, "security.cannotChangePassword.tooSoon", formatDate(requiredData));
            return mapping.findForward("failure");
        } catch (PasswordPolicyViolationException e) {
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.CHANGE_PASSWORD, null, info, e));
            saveError(request, "changePassword.error.doesNotMatchPolicy");
            return mapping.findForward("failure");
        } catch (Exception e) {
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.CHANGE_PASSWORD, null, info, e));
            throw e;
        }

        return mapping.findForward("success");
    }
View Full Code Here

            throw expt;
        }
    }

    private void fireSuccessfulEvent(SessionInfo sessionInfo, int eventId, Role role, List<String> selectedUsers) {
        CoreEvent coreEvent = new CoreEvent(this, eventId, role, sessionInfo);
        coreEvent.addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_ID, role.getPrincipalName());
        if (!selectedUsers.isEmpty()) {
            for (int index = 0; index < selectedUsers.size(); index++) {
                String username = selectedUsers.get(index);
                coreEvent.addAttribute(CoreAttributeConstants.EVENT_ATTR_ACCOUNT + Integer.valueOf(index), username);
            }
        }
        CoreServlet.getServlet().fireCoreEvent(coreEvent);
    }
View Full Code Here

        }
        CoreServlet.getServlet().fireCoreEvent(coreEvent);
    }

    private void fireUnsuccessfulEvent(RoleForm roleForm, SessionInfo sessionInfo, int eventId, Exception ex) {
        CoreEvent coreEvent = new CoreEvent(this, eventId, null, sessionInfo, ex);
        coreEvent.addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_ID, roleForm.getRolename());
        CoreServlet.getServlet().fireCoreEvent(coreEvent);
    }
View Full Code Here

            for (int i = 0; accounts != null && i < accounts.length; i++) {
                User user = udb.getAccount(accounts[i]);
                if(udb.supportsAccountCreation()) {
                  try {
                        udb.deleteAccount(user);
                        CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.USER_REMOVED, null, null, CoreEvent.STATE_SUCCESSFUL)
                            .addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_ID, user.getPrincipalName())
                            .addAttribute(CoreAttributeConstants.EVENT_ATTR_FULL_NAME, user.getFullname()));
                  } catch (Exception e) {
                      CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.USER_REMOVED, null, null, e)
                            .addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_ID, user.getPrincipalName())
                            .addAttribute(CoreAttributeConstants.EVENT_ATTR_FULL_NAME, user.getFullname()));
                    throw e;
                  }
                }
View Full Code Here

      for (String key : ticketsToRemove) {
        logonsBySessionId.remove(key);
      }
    }
        session.release();
    CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.LOGOFF, null, session));
  }
View Full Code Here

     * been initialised. This is repeated in the actions the page
     * intercept listeners redirect to
     */
    if (fireEvent) {
      CoreServlet.getServlet()
              .fireCoreEvent(new CoreEvent(this, CoreEventConstants.LOGON, scheme, info).addAttribute(CoreAttributeConstants.EVENT_ATTR_IP_ADDRESS,
                request.getRemoteAddr())
                      .addAttribute(CoreAttributeConstants.EVENT_ATTR_HOST, request.getRemoteHost())
                      .addAttribute(CoreAttributeConstants.EVENT_ATTR_SCHEME, scheme.getSchemeName()));
    }
  }
View Full Code Here

     */
    public void updateResource(Resource resource, SessionInfo session) throws Exception {
        try {
            AccessRights accessRights = (AccessRights) resource;
            PolicyDatabaseFactory.getInstance().updateAccessRights(accessRights);
            CoreEvent coreEvent = addAccessRightsAttributes(new ResourceChangeEvent(this, CoreEventConstants.UPDATE_ACCESS_RIGHT,
                            resource, session, CoreEvent.STATE_SUCCESSFUL), accessRights);

            List permissionsList = accessRights.getAccessRights();
            if (permissionsList != null) {
                int j = 0;
                for (Iterator i = permissionsList.iterator(); i.hasNext();) {
                    j++;
                    AccessRight permission = (AccessRight) i.next();

                    MessageResources mrPermission = CoreUtil.getMessageResources(session.getHttpSession(), permission
                                    .getPermission().getBundle());
                    String permissionName = mrPermission.getMessage("permission." + permission.getPermission().getId() + ".title");

                    MessageResources mrResourceType = CoreUtil.getMessageResources(session.getHttpSession(), permission
                                    .getResourceType().getBundle());
                    String resourceTypeName = mrResourceType.getMessage("resourceType."
                                    + permission.getResourceType().getResourceTypeId() + ".title");

                    coreEvent.addAttribute(CoreAttributeConstants.EVENT_ATTR_TYPE_PERMISSION + Integer.toString(j), permissionName
                                    + " " + resourceTypeName);
                }
            }
            coreEvent.addAttribute(CoreAttributeConstants.EVENT_ATTR_TYPE_ACCESS_RIGHT, getAccessRightType(session, accessRights
                            .getAccessRightsClass()));
            CoreServlet.getServlet().fireCoreEvent(coreEvent);
        } catch (Exception e) {
            CoreServlet.getServlet().fireCoreEvent(
                new ResourceChangeEvent(this, CoreEventConstants.UPDATE_ACCESS_RIGHT, session, e));
View Full Code Here

    throws Exception {
        ActionMessages msgs = new ActionMessages();
        String sel = ((ShowKeyStoreForm)form).getSelectedItem();
        ((ShowKeyStoreForm)form).getSelectedKeyStore().deleteCertificate(sel);
        CoreServlet.getServlet().fireCoreEvent(
                        new CoreEvent(this, CoreEventConstants.KEYSTORE_CERTIFICATE_DELETED, sel, LogonControllerFactory.getInstance().getSessionInfo(request))
                        .addAttribute(CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_ALIAS, sel));
        msgs.add(Globals.MESSAGE_KEY, new ActionMessage("keyStore.certificates.remove.message.certificateRemoved", sel));
        saveMessages(request, msgs);
        ActionForward fwd = mapping.findForward("reload");
        String orig = fwd.getPath();
View Full Code Here

    if (log.isInfoEnabled())
      log.info("Removing extension bundle " + bundle.getId());
    boolean containsPlugin = bundle.isContainsPlugin();
    try {
      CoreServlet.getServlet()
              .fireCoreEvent(new CoreEvent(this,
                      CoreEventConstants.REMOVING_EXTENSION,
                      bundle,
                      null,
                      CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_EXTENSION_ID,
                bundle.getId())
                      .addAttribute(CoreAttributeConstants.EVENT_ATTR_EXTENSION_NAME, bundle.getName()));
      bundle.removeBundle();
      VERSION_PREFS.remove(bundle.getId());
      CoreServlet.getServlet()
              .fireCoreEvent(new CoreEvent(this,
                      CoreEventConstants.REMOVE_EXTENSION,
                      bundle,
                      null,
                      CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_EXTENSION_ID,
                bundle.getId())
                      .addAttribute(CoreAttributeConstants.EVENT_ATTR_EXTENSION_NAME, bundle.getName()));
      if (containsPlugin) {
        if (!ExtensionStore.getInstance().isRepositoryBacked()) {
          if (log.isInfoEnabled())
            log.info("Extension " + bundle.getId() + " contains plugins, deferring removal until restart.");
          StringBuffer toRemove = new StringBuffer(STORE_PREF.get(DIRS_TO_REMOVE, ""));
          if (toRemove.length() > 0) {
            toRemove.append(",");
          }
          toRemove.append(bundle.getBaseDir());
          STORE_PREF.put(DIRS_TO_REMOVE, toRemove.toString());
        }
      }
      ExtensionStoreStatusManager.removeExtension(bundle.getId());
    } catch (Exception e) {
      CoreServlet.getServlet()
              .fireCoreEvent(new CoreEvent(this, CoreEventConstants.REMOVE_EXTENSION, null, null, e).addAttribute(CoreAttributeConstants.EVENT_ATTR_EXTENSION_ID,
                bundle.getId())
                      .addAttribute(CoreAttributeConstants.EVENT_ATTR_EXTENSION_NAME, bundle.getName()));

      throw e;
    } finally {
View Full Code Here

TOP

Related Classes of com.adito.core.CoreEvent

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.