Package com.adito.core

Examples of com.adito.core.CoreEvent


    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


        return mapping.findForward("display");
    }
    if(rf.isEditing()) {
      try {
            WebForwardDatabaseFactory.getInstance().updateReplacement(rf.getReplacement());
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, WebForwardEventConstants.UPDATE_REPLACEMENT, null, info, CoreEvent.STATE_SUCCESSFUL)
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, rf.getReplaceType())
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_PATTERN, rf.getReplacement().getReplacePattern()));
      } catch (Exception e) {
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, WebForwardEventConstants.UPDATE_REPLACEMENT, null, info, CoreEvent.STATE_UNSUCCESSFUL)
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, rf.getReplaceType())
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_PATTERN, rf.getReplacement().getReplacePattern()));
        throw e;
      }
    }
    else {
      try {
            WebForwardDatabaseFactory.getInstance().createReplacement(rf.getReplacement());
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, WebForwardEventConstants.CREATE_REPLACEMENT, null, info, CoreEvent.STATE_SUCCESSFUL)
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, rf.getReplaceType())
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_PATTERN, rf.getReplacement().getReplacePattern()));
      } catch (Exception e) {
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, WebForwardEventConstants.CREATE_REPLACEMENT, null, info, CoreEvent.STATE_UNSUCCESSFUL)
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, rf.getReplaceType())
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_PATTERN, rf.getReplacement().getReplacePattern()));
        throw e;
      }
    }
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

        rep2.setReplacePattern(replacePattern1);
        SessionInfo info = this.getSessionInfo(request);
        try {
            WebForwardDatabaseFactory.getInstance().updateReplacement(rep1);
            CoreServlet.getServlet().fireCoreEvent(
                new CoreEvent(this, WebForwardEventConstants.REPLACEMENT_PRECEDENCE_CHANGED, null, info, CoreEvent.STATE_SUCCESSFUL).addAttribute(
                                WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, String.valueOf(rep1.getReplaceType())));
            try {
                WebForwardDatabaseFactory.getInstance().updateReplacement(rep2);
                CoreServlet.getServlet().fireCoreEvent(
                    new CoreEvent(this, WebForwardEventConstants.REPLACEMENT_PRECEDENCE_CHANGED, null, info, CoreEvent.STATE_SUCCESSFUL)
                                    .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, String.valueOf(rep2
                                                    .getReplaceType())));
                return mapping.findForward("success");
            } catch (Exception e) {
                CoreServlet.getServlet().fireCoreEvent(
                    new CoreEvent(this, WebForwardEventConstants.REPLACEMENT_PRECEDENCE_CHANGED, null, info, CoreEvent.STATE_UNSUCCESSFUL)
                                    .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, String.valueOf(rep2
                                                    .getReplaceType())));
                throw e;
            }
        } catch (Exception e) {
            CoreServlet.getServlet().fireCoreEvent(
                new CoreEvent(this, WebForwardEventConstants.REPLACEMENT_PRECEDENCE_CHANGED, null, info, CoreEvent.STATE_UNSUCCESSFUL).addAttribute(
                                WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, String.valueOf(rep1.getReplaceType())));
            throw e;
        }
    }
View Full Code Here

            for (Iterator i = sel.iterator(); i.hasNext();) {
                Replacement r = (Replacement) i.next();
                try {
                    WebForwardDatabaseFactory.getInstance().deleteReplacement(r.getSequence());
                    CoreServlet.getServlet().fireCoreEvent(
                        new CoreEvent(this, WebForwardEventConstants.DELETE_REPLACEMENT, null, info, CoreEvent.STATE_SUCCESSFUL)
                                        .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_SEQUENCE, String.valueOf(r
                                                        .getSequence())));
                    ActionMessages msgs = new ActionMessages();
                    msgs.add(Globals.ERROR_KEY, new ActionMessage("replacements.message.replacementsDeleted", String.valueOf(sel
                                    .size())));
                    saveMessages(request, msgs);
                } catch (Exception e) {
                    CoreServlet.getServlet().fireCoreEvent(
                        new CoreEvent(this, WebForwardEventConstants.DELETE_REPLACEMENT, null, info, CoreEvent.STATE_UNSUCCESSFUL)
                                        .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_SEQUENCE, String.valueOf(r
                                                        .getSequence())));
                }
            }
        }
View Full Code Here

                if (type == WebForward.TYPE_TUNNELED_SITE) {
                    com.adito.webforwards.TunneledSiteWebForward sswf = new com.adito.webforwards.TunneledSiteWebForward(user.getRealm().getRealmID(),
                                    -1, destinationURL, name, description, category, autoStart, now, now);
                    webForward = WebForwardDatabaseFactory.getInstance().createWebForward(sswf);
                    CoreEvent evt = new ResourceChangeEvent(this, WebForwardEventConstants.CREATE_WEB_FORWARD, webForward, this
                                    .getSessionInfo(request), CoreEvent.STATE_SUCCESSFUL).addAttribute(
                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_CATEGORY, webForward.getCategory()).addAttribute(
                                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
                        ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(webForward.getType())).getName()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL, webForward.getDestinationURL());
                    CoreServlet.getServlet().fireCoreEvent(evt);
                } else if (type == WebForward.TYPE_REPLACEMENT_PROXY) {
                    com.adito.webforwards.ReplacementProxyWebForward spwf = new com.adito.webforwards.ReplacementProxyWebForward(user.getRealm().getRealmID(),
                                    -1, destinationURL, name, description, category, authenticationUsername,
                                    authenticationPassword, preferredAuthenticationScheme, encodeing, restrictToHosts, formType,
                                    formParameters, autoStart, now, now);

                    AbstractAuthenticatingWebForward abstractAuthenticatingWebForward = (AbstractAuthenticatingWebForward) WebForwardDatabaseFactory
                                    .getInstance().createWebForward(spwf);
                    CoreEvent evt = new ResourceChangeEvent(this, WebForwardEventConstants.CREATE_WEB_FORWARD, abstractAuthenticatingWebForward, this
                                    .getSessionInfo(request), CoreEvent.STATE_SUCCESSFUL).addAttribute(
                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_CATEGORY, abstractAuthenticatingWebForward.getCategory()).addAttribute(
                                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
                        ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(abstractAuthenticatingWebForward.getType())).getName()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL, abstractAuthenticatingWebForward.getDestinationURL()).addAttribute(
                                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_PREFERED_AUTH_SCHEME,
                        abstractAuthenticatingWebForward.getPreferredAuthenticationScheme()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_AUTH_USERNAME,
                        abstractAuthenticatingWebForward.getAuthenticationUsername()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_AUTH_FORM_TYPE,
                        abstractAuthenticatingWebForward.getFormType()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_WEB_FORWARD_ENCODEING, spwf.getEncoding());

                    spwf.addFormParametersToEvent(evt, WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_AUTH_FORM_PARAMETERS);
                    spwf
                                    .addRestrictToHostsToEvent(evt,
                                                    WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_WEB_FORWARD_RESTRICT_TO_HOSTS);
                    CoreServlet.getServlet().fireCoreEvent(evt);
                    webForward = abstractAuthenticatingWebForward;
                } else if (type == WebForward.TYPE_PATH_BASED_REVERSE_PROXY || type == WebForward.TYPE_HOST_BASED_REVERSE_PROXY) {
                    com.adito.webforwards.ReverseProxyWebForward rpwf = new com.adito.webforwards.ReverseProxyWebForward(user.getRealm().getRealmID(),
                                    -1, type, destinationURL, name, description, category, authenticationUsername,
                                    authenticationPassword, preferredAuthenticationScheme, formType, formParameters, paths,
                                    hostHeader, activeDNS, autoStart, now, now, encodeing);
                    AbstractAuthenticatingWebForward abstractAuthenticatingWebForward = (AbstractAuthenticatingWebForward) WebForwardDatabaseFactory
                                    .getInstance().createWebForward(rpwf);
                    CoreEvent evt = new ResourceChangeEvent(this, WebForwardEventConstants.CREATE_WEB_FORWARD, abstractAuthenticatingWebForward, this
                                    .getSessionInfo(request), CoreEvent.STATE_SUCCESSFUL).addAttribute(
                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_CATEGORY, abstractAuthenticatingWebForward.getCategory()).addAttribute(
                                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
                        ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(abstractAuthenticatingWebForward.getType())).getName()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL, abstractAuthenticatingWebForward.getDestinationURL()).addAttribute(
View Full Code Here

                            + Util.escapeForDNString((String) seq.getAttribute(CreateNewCertificateForm.ATTR_COUNTRY_CODE, ""));
            mgr.createKey(alias, dname);
            Property.setProperty(new ContextKey("webServer.keyStoreType"), KeyStoreManager.TYPE_JKS.getName(), null);
            Property.setProperty(new ContextKey("webServer.alias"), alias, null);

            CoreEvent coreEvent = new CoreEvent(this, CoreEventConstants.KEYSTORE_CERTIFICATE_CREATED, alias, null).addAttribute(
                CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_ALIAS, alias).addAttribute(CreateNewCertificateForm.ATTR_HOSTNAME,
                (String) seq.getAttribute(CreateNewCertificateForm.ATTR_HOSTNAME, "")).addAttribute(
                CreateNewCertificateForm.ATTR_ORGANISATIONAL_UNIT,
                (String) seq.getAttribute(CreateNewCertificateForm.ATTR_ORGANISATIONAL_UNIT, "")).addAttribute(
                CreateNewCertificateForm.ATTR_COMPANY, (String) seq.getAttribute(CreateNewCertificateForm.ATTR_COMPANY, ""))
View Full Code Here

               
            }

            Property.setProperty(new ContextKey("webServer.alias"), alias, null);
            Property.setProperty(new ContextKey("webServer.keystore.sslCertificate.password"), passphrase, null);
            CoreEvent coreEvent = new CoreEvent(this, CoreEventConstants.KEYSTORE_IMPORTED, null, null).addAttribute(
                CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_ALIAS, alias).addAttribute(CreateNewCertificateForm.ATTR_HOSTNAME,
                (String) seq.getAttribute(CreateNewCertificateForm.ATTR_HOSTNAME, "")).addAttribute(
                CreateNewCertificateForm.ATTR_ORGANISATIONAL_UNIT,
                (String) seq.getAttribute(CreateNewCertificateForm.ATTR_ORGANISATIONAL_UNIT, "")).addAttribute(
                CreateNewCertificateForm.ATTR_COMPANY, (String) seq.getAttribute(CreateNewCertificateForm.ATTR_COMPANY, ""))
View Full Code Here

     *      com.adito.security.SessionInfo)
     */
    public Resource removeResource(int resourceId, SessionInfo session) throws Exception {
        try {
            WebForward resource = WebForwardDatabaseFactory.getInstance().deleteWebForward(resourceId);
            CoreEvent evt = new ResourceDeleteEvent(this, WebForwardEventConstants.DELETE_WEBFORWARD, resource, session,
                            CoreEvent.STATE_SUCCESSFUL).addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL,
                resource.getDestinationURL()).addAttribute(WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
                ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(resource.getType())).getName());
            CoreServlet.getServlet().fireCoreEvent(evt);
            return resource;
View Full Code Here

            Policy pol =PolicyDatabaseFactory.getInstance().createPolicy(policyName, policyDescription, Policy.TYPE_NORMAL, getSessionInfo(request).getUser().getRealm().getRealmID());
    
            actionStatus.add(new WizardActionStatus(WizardActionStatus.COMPLETED_OK,
                            "policyWizard.policyFinish.status.policyCreated"));

            CoreEvent coreEvent = new ResourceChangeEvent(this, CoreEventConstants.CREATE_POLICY, pol, getSessionInfo(request),
                    CoreEvent.STATE_SUCCESSFUL);
            CoreServlet.getServlet().fireCoreEvent(coreEvent);
           
            try {
              UserDatabase udb = UserDatabaseManager.getInstance().getUserDatabase(LogonControllerFactory.getInstance().getSessionInfo(request).getUser().getRealm());
                for (Iterator i = ((PropertyList) seq.getAttribute(PolicyPrincipalSelectionForm.ATTR_SELECTED_ACCOUNTS, null))
                                .iterator(); i.hasNext();) {
                    User user = udb.getAccount((String) i.next());
                    PolicyDatabaseFactory.getInstance().grantPolicyToPrincipal(pol,
                                    user);
                    CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.GRANT_POLICY_TO_PRINCIPAL, pol, getSessionInfo(request),
                            CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_TYPE, "user").addAttribute(
                            CoreAttributeConstants.EVENT_ATTR_POLICY_NAME,
                            pol.getResourceName()).addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_ID, user.getPrincipalName()));
                }
                for (Iterator i = ((PropertyList) seq.getAttribute(PolicyPrincipalSelectionForm.ATTR_SELECTED_ROLES, null))
                                .iterator(); i.hasNext();) {
                    Role role = udb.getRole((String) i.next());
                    PolicyDatabaseFactory.getInstance().grantPolicyToPrincipal(pol,
                                    role);

                    CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.GRANT_POLICY_TO_PRINCIPAL, pol, getSessionInfo(request),
                        CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_TYPE, "group").addAttribute(
                        CoreAttributeConstants.EVENT_ATTR_POLICY_NAME,
                        pol.getResourceName()).addAttribute(CoreAttributeConstants.EVENT_ATTR_PRINCIPAL_ID, role.getPrincipalName()));
                }
                actionStatus.add(new WizardActionStatus(WizardActionStatus.COMPLETED_OK,
                                "policyWizard.policyFinish.status.grantedToPrincipals"));
            } catch (Exception e) {
                log.error("Failed to grant principals to policy.", e);
                actionStatus.add(new WizardActionStatus(WizardActionStatus.COMPLETED_WITH_ERRORS,
                                "policyWizard.policyFinish.status.failedToGrantToPrincipals", e.getMessage()));
                CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, CoreEventConstants.GRANT_POLICY_TO_PRINCIPAL, null, getSessionInfo(request), e));
            }
        } catch (Exception e) {
            log.error("Failed to create policy.", e);
            actionStatus.add(new WizardActionStatus(WizardActionStatus.COMPLETED_WITH_ERRORS,
                            "policyWizard.policyFinish.status.failedToCreatePolicy", e.getMessage()));
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.