Examples of SecurityScenario


Examples of org.wso2.carbon.security.SecurityScenario

    public String[] getRequiredModules(String serviceName, String moduleId) throws Exception {
        SecurityScenarioData securityScenarioData = getCurrentScenario(serviceName);

        if (securityScenarioData != null) {
            SecurityScenario securityScenario = SecurityScenarioDatabase.get(securityScenarioData
                    .getScenarioId());
            String[] moduleNames = (String[]) securityScenario.modules
                    .toArray(new String[securityScenario.modules.size()]);
            return moduleNames;
        }
View Full Code Here

Examples of org.wso2.carbon.security.SecurityScenario

            log.debug("Removing " + policyResourcePath);
            if (!registry.resourceExists(policyResourcePath)) {
                return;
            }
            SecurityScenario scenario = readCurrentScenario(serviceName);
            if (scenario == null) {
                return;
            }

            String secPolicyPath = servicePath + RegistryResources.POLICIES + scenario.getWsuId();
            if (registry.resourceExists(secPolicyPath)) {
                registry.delete(secPolicyPath);
            }

            String[] moduleNames = scenario.getModules().toArray(
                    new String[scenario.getModules().size()]);

            // disengage modules
            for (String moduleName : moduleNames) {
                AxisModule module = service.getAxisConfiguration().getModule(moduleName);
                service.disengageModule(module);

                String modPath = RegistryResources.MODULES + module.getName() + "/" + module.getVersion();
                registry.removeAssociation(servicePath, modPath,
                        RegistryResources.Associations.ENGAGED_MODULES);
            }

            // remove poicy
            SecurityServiceAdmin admin = new SecurityServiceAdmin(axisConfig, registry);
            admin.removeSecurityPolicyFromAllBindings(service, scenario.getWsuId());

            String scenarioId = scenario.getScenarioId();
            String resourceUri = SecurityConstants.SECURITY_POLICY + "/" + scenarioId;

            // unpersist data
            try {
                boolean transactionStarted = Transaction.isStarted();
View Full Code Here

Examples of org.wso2.carbon.security.SecurityScenario

    }

    protected boolean engageModules(String scenarioId, String serviceName, AxisService axisService)
            throws SecurityConfigException {
        boolean isRahasEngaged = false;
        SecurityScenario securityScenario = SecurityScenarioDatabase.get(scenarioId);
        String[] moduleNames = (String[]) securityScenario.modules
                .toArray(new String[securityScenario.modules.size()]);

        String servicePath = RegistryResources.SERVICE_GROUPS
                + axisService.getAxisServiceGroup().getServiceGroupName()
View Full Code Here

Examples of org.wso2.carbon.security.SecurityScenario

                Parameter param = service.getParameter(SecurityConstants.SECURITY_POLICY_PATH);
                if (param == null || !policyPath.equals(param.getValue())) {
                    return data;
                }
            } else {
                SecurityScenario scenario = readCurrentScenario(serviceName);
                if (scenario == null || !scenario.getScenarioId().equals(scenarioId)) {
                    return data;
                }
            }

            data = new SecurityConfigData();
View Full Code Here

Examples of org.wso2.carbon.security.SecurityScenario

        }
        return data;
    }

    public SecurityScenario readCurrentScenario(String serviceName) throws SecurityConfigException {
        SecurityScenario scenario = null;

        try {
            AxisService service = axisConfig.getServiceForActivation(serviceName);
            if (service == null) {
                throw new SecurityConfigException("AxisService is Null");
View Full Code Here

Examples of org.wso2.carbon.security.SecurityScenario

            Collection<SecurityScenario> scenarios = SecurityScenarioDatabase.getAllScenarios();
            UserRegistry tenantUserRegistry =
                                              IdentitySTSMgtServiceComponent.getRegistryService()
                                                                            .getConfigSystemRegistry(tenantId);
            for (Iterator<SecurityScenario> ite = scenarios.iterator(); ite.hasNext();) {
                SecurityScenario scenario = ite.next();
                String scenarioId = scenario.getScenarioId();
                if (!scenarioId.equals(SecurityConstants.SCENARIO_DISABLE_SECURITY) &&
                        !scenarioId.equals(SecurityConstants.POLICY_FROM_REG_SCENARIO)) {
                    String resourceUri = SecurityConstants.SECURITY_POLICY + "/" + scenarioId;
                    if (!scenarioId.equals(SecurityConstants.SCENARIO_DISABLE_SECURITY) &&
                            !scenarioId.equals(SecurityConstants.POLICY_FROM_REG_SCENARIO)) {
View Full Code Here

Examples of org.wso2.carbon.security.SecurityScenario

            if (!transactionStarted) {
                registry.beginTransaction();
            }

            for (OMElement scenarioEle : elements) {
                SecurityScenario scenario = new SecurityScenario();
                String scenarioId = scenarioEle.getAttribute(SecurityConstants.ID_QN)
                        .getAttributeValue();

                scenario.setScenarioId(scenarioId);
                scenario.setSummary(scenarioEle.getFirstChildWithName(SecurityConstants.SUMMARY_QN)
                        .getText());
                scenario.setDescription(scenarioEle.getFirstChildWithName(
                        SecurityConstants.DESCRIPTION_QN).getText());
                scenario.setCategory(scenarioEle.getFirstChildWithName(SecurityConstants.CATEGORY_QN)
                        .getText());
                scenario.setWsuId(scenarioEle.getFirstChildWithName(SecurityConstants.WSUID_QN)
                        .getText());
                scenario.setType(scenarioEle.getFirstChildWithName(SecurityConstants.TYPE_QN).getText());

                OMElement genPolicyElem = scenarioEle.getFirstChildWithName(SecurityConstants.IS_GEN_POLICY_QN);
                if (genPolicyElem != null && genPolicyElem.getText().equals("false")) {
                    scenario.setGeneralPolicy(false);
                }

                String resourceUri = SecurityConstants.SECURITY_POLICY + "/" + scenarioId;

                for (Iterator modules = scenarioEle.getFirstChildWithName(SecurityConstants.MODULES_QN)
                        .getChildElements(); modules.hasNext();) {
                    String module = ((OMElement) modules.next()).getText();
                    scenario.addModule(module);
                }

                // Save it in the DB
                SecurityScenarioDatabase.put(scenarioId, scenario);
View Full Code Here

Examples of org.wso2.carbon.security.SecurityScenario

                    return;
                }

                Collection coll = (Collection) registry.get(policyResourcePath);
                String[] policies = coll.getChildren();
                SecurityScenario scenario = null;
                for (int i = 0; i < policies.length; i++) {
                    String value = policies[i];
                    String policyId = value.substring(policyResourcePath.length());
                    scenario = SecurityScenarioDatabase.getByWsuId(policyId);
                    if (scenario != null) {
View Full Code Here

Examples of org.wso2.carbon.security.SecurityScenario

            if (!transactionStarted) {
                registry.beginTransaction();
            }

            for (OMElement scenarioEle : elements) {
                SecurityScenario scenario = new SecurityScenario();
                String scenarioId = scenarioEle.getAttribute(SecurityConstants.ID_QN)
                        .getAttributeValue();

                scenario.setScenarioId(scenarioId);
                scenario.setSummary(scenarioEle.getFirstChildWithName(SecurityConstants.SUMMARY_QN)
                        .getText());
                scenario.setDescription(scenarioEle.getFirstChildWithName(
                        SecurityConstants.DESCRIPTION_QN).getText());
                scenario.setCategory(scenarioEle.getFirstChildWithName(SecurityConstants.CATEGORY_QN)
                        .getText());
                scenario.setWsuId(scenarioEle.getFirstChildWithName(SecurityConstants.WSUID_QN)
                        .getText());
                scenario.setType(scenarioEle.getFirstChildWithName(SecurityConstants.TYPE_QN).getText());

                String resourceUri = SecurityConstants.SECURITY_POLICY + "/" + scenarioId;

                for (Iterator modules = scenarioEle.getFirstChildWithName(SecurityConstants.MODULES_QN)
                        .getChildElements(); modules.hasNext();) {
                    String module = ((OMElement) modules.next()).getText();
                    scenario.addModule(module);
                }

                // Save it in the DB
                SecurityScenarioDatabase.put(scenarioId, scenario);
View Full Code Here

Examples of org.wso2.carbon.security.SecurityScenario

        }
    }

    public SecurityScenarioData getSecurityScenario(String sceneId) throws SecurityConfigException {
        SecurityScenarioData data = null;
        SecurityScenario scenario = SecurityScenarioDatabase.get(sceneId);
        if (scenario != null) {
            data = new SecurityScenarioData();
            data.setCategory(scenario.getCategory());
            data.setDescription(scenario.getDescription());
            data.setScenarioId(scenario.getScenarioId());
            data.setSummary(scenario.getSummary());
        }
        return data;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.