Examples of SecurityConfigException


Examples of org.wso2.carbon.security.SecurityConfigException

    public void applySecurity(String serviceName, String scenarioId, KerberosConfigData kerberosConfigurations)
            throws SecurityConfigException {

        if (kerberosConfigurations == null) {
            log.error("Kerberos configurations provided are invalid.");
            throw new SecurityConfigException("Kerberos configuration parameters are null. " +
                    "Please specify valid kerberos configurations.");
        }

        try {

            // Begin registry transaction
            boolean transactionStarted = Transaction.isStarted();
            if (!transactionStarted) {
                registry.beginTransaction();
            }

            // Disable security if already a policy is applied
            this.disableSecurityOnService(serviceName);

            AxisService service = axisConfig.getServiceForActivation(serviceName);
            if (service == null) {
                throw new SecurityConfigException("nullService");
            }

            boolean isRahasEngaged = false;
            applyPolicy(service, scenarioId, null, null, null, kerberosConfigurations);

            isRahasEngaged = engageModules(scenarioId, serviceName, service);

            if (!isRahasEngaged) {
                log.info("Rahas engaged to service - " + serviceName);
            }

            disableRESTCalls(serviceName, scenarioId);

            persistsKerberosData(service, kerberosConfigurations);

            if (!transactionStarted) {
                registry.commitTransaction();
            }
        } catch (RegistryException e) {
            StringBuilder str = new StringBuilder("Error persisting security scenario ").
                    append(scenarioId).append(" for service ").append(serviceName);
            log.error(str.toString(),e);
            try {
                registry.rollbackTransaction();
            } catch (RegistryException ex) {
                log.error("An error occurred while rollback, registry.", ex);
            }
            throw new SecurityConfigException(str.toString(), e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.security.SecurityConfigException

            if (userGroups != null) {
                Arrays.sort(userGroups);
                if (Arrays.binarySearch(userGroups, CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME) > -1) {
                    log
                            .error("Security breach. A user is attempting to enable annonymous for UT access");
                    throw new SecurityConfigException("Invalid data provided"); // obscure error message
                }
            }

            boolean transactionStarted = Transaction.isStarted();
            if (!transactionStarted) {
                registry.beginTransaction();
            }
            this.disableSecurityOnService(serviceName);

            AxisService service = axisConfig.getServiceForActivation(serviceName);
            if (service == null) {
                throw new SecurityConfigException("nullService");
            }
            boolean isRahasEngaged = false;
            applyPolicy(service, scenrioId, policyPath, trustedStores, privateStore);
            isRahasEngaged = engageModules(scenrioId, serviceName, service);
            disableRESTCalls(serviceName, scenrioId);
View Full Code Here

Examples of org.wso2.carbon.security.SecurityConfigException

    public void applyKerberosSecurityPolicy(String serviceName, String policyId, String servicePrincipalName,
                                            String servicePrincipalPassword)
            throws SecurityConfigException {

        if (servicePrincipalName == null || servicePrincipalName.trim().equals("")) {
            throw new SecurityConfigException("Please specify a valid service principal. " +
                    "Service principal should not be null");
        }

        if (servicePrincipalPassword == null || servicePrincipalPassword.trim().equals("")) {
            throw new SecurityConfigException("Please specify a valid service principal password. " +
                    "Service principal password should not be null");
        }

        SecurityConfigAdmin admin = new SecurityConfigAdmin(getUserRealm(), getConfigSystemRegistry(), getAxisConfig());
View Full Code Here

Examples of org.wso2.carbon.security.SecurityConfigException

             * serviceAdmin.setBindingPolicy(service.getBindingName(),
             * bindingName, policy .toString()); }
             */
        } catch (ServerException e) {
            log.error(e.getMessage(), e);
            throw new SecurityConfigException(e.getMessage(), e);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new SecurityConfigException(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.security.SecurityConfigException

                log.error(msg);
                throw new AxisFault(msg, e);
            }
        } catch (AxisFault e) {
            log.error(e);
            throw new SecurityConfigException(e.getMessage(), e);
        } catch (RegistryException e) {
            log.error(e);
            throw new SecurityConfigException(e.getMessage(), e);
        }
        return isRahasEngaged;
    }
View Full Code Here

Examples of org.wso2.carbon.security.SecurityConfigException

        }

        try {
            AxisService service = axisConfig.getServiceForActivation(serviceName);
            if (service == null) {
                throw new SecurityConfigException("nullService");
            }

            Parameter param = new Parameter();
            param.setName("disableREST"); // TODO Find the constant
            param.setValue(Boolean.TRUE.toString());
            service.addParameter(param);

        } catch (AxisFault e) {
            log.error(e);
            throw new SecurityConfigException("disablingREST", e);
        }

    }
View Full Code Here

Examples of org.wso2.carbon.security.SecurityConfigException

                } else if (KeyStoreUtil.isPrimaryStore(privateStore)) {
                    registry.addAssociation(servicePath, RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH +
                                                RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE,
                                                SecurityConstants.ASSOCIATION_PRIVATE_KEYSTORE);
                } else {
                    throw new SecurityConfigException("Missing key store " + privateStore);
                }
            }

            if (trustedStores != null) {
                for (String storeName : trustedStores) {
                    String ksPath = SecurityConstants.KEY_STORES + "/" + storeName;
                    if (govRegistry.resourceExists(ksPath)) {
                        registry.addAssociation(servicePath, RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH +
                                                    ksPath, SecurityConstants.ASSOCIATION_TRUSTED_KEYSTORE);
                    } else if (KeyStoreUtil.isPrimaryStore(storeName)) {
                        registry.addAssociation(servicePath, RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH +
                                                     RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE,
                                                     SecurityConstants.ASSOCIATION_TRUSTED_KEYSTORE);
                    } else {
                        throw new SecurityConfigException("Missing key store" + storeName);
                    }
                }
            } else {
                trustedStores = new String[0];
            }

            if (userGroups != null) {
                AuthorizationManager acAdmin = realm.getAuthorizationManager();

                for (int i = 0; i < userGroups.length; i++) {
                    String value = userGroups[i];
                    acAdmin.authorizeRole(value, servicePath,
                            UserCoreConstants.INVOKE_SERVICE_PERMISSION);
                }
            }

            if (isRahasEngaged) {
                setRahasParameters(service, privateStore);
            } else {
                removeRahasParameters(service);
            }

        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new SecurityConfigException(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.security.SecurityConfigException

            }

            return PolicyEngine.getPolicy(policyElement);
        } catch (Exception e) {
            log.error(e);
            throw new SecurityConfigException("loadingPolicy", e);
        }

    }
View Full Code Here

Examples of org.wso2.carbon.security.SecurityConfigException

                    String krbFile = carbonConfig + File.separatorChar + KerberosConfigData.KERBEROS_CONFIG_FILE_NAME;
                    File krbFileObject = new File(krbFile);

                    if (!krbFileObject.exists()) {
                        throw new SecurityConfigException("Kerberos configuration file not found at " + krbFile);
                    }

                } else {
                    throw new SecurityConfigException("Could not retrieve carbon home");
                }

                rampartConfig.setKerberosConfig(kerberosConfig);

View Full Code Here

Examples of org.wso2.carbon.security.SecurityConfigException

            throws SecurityConfigException, AxisFault {

        AxisService axisService = axisConfig.getServiceForActivation(serviceId);

        if (axisService == null) {
            throw new SecurityConfigException("nullService");
        }

        ArrayList<String> transports = new ArrayList<String>();
        for (int i = 0; i < transportProtocols.size(); i++) {
            transports.add(transportProtocols.get(i));
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.