Package org.wso2.carbon.security

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


                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

        }

        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

                } 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

            }

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

    }
View Full Code Here

                    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

            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

                    }
                }
            }
        } catch (WSSPolicyException e) {
            log.error(e);
            throw new SecurityConfigException(e.getMessage(), e);
        }

        return httpsRequired;
    }
View Full Code Here

        SecurityScenario scenario = null;

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

            // at registry
            String servicePath = RegistryResources.SERVICE_GROUPS
                    + service.getAxisServiceGroup().getServiceGroupName()
                    + RegistryResources.SERVICES + serviceName;

            String policyResourcePath = servicePath + RegistryResources.POLICIES;

            if (!registry.resourceExists(policyResourcePath)) {
                return scenario;
            }

            Map endPointMap = service.getEndpoints();
            for (Object o : endPointMap.entrySet()) {
                scenario = null;

                Map.Entry entry = (Map.Entry) o;
                AxisEndpoint point = (AxisEndpoint) entry.getValue();
                AxisBinding binding = point.getBinding();
                java.util.Collection policies = binding.getPolicySubject()
                        .getAttachedPolicyComponents();
                Iterator policyComponents = policies.iterator();
                String policyId = "";
                while (policyComponents.hasNext()) {
                    PolicyComponent currentPolicyComponent = (PolicyComponent) policyComponents
                            .next();
                    if (currentPolicyComponent instanceof Policy) {
                        policyId = ((Policy) currentPolicyComponent).getId();
                    } else if (currentPolicyComponent instanceof PolicyReference) {
                        policyId = ((PolicyReference) currentPolicyComponent).getURI().substring(1);
                    }

                    // Check whether this is a security scenario
                    scenario = SecurityScenarioDatabase.getByWsuId(policyId);
                }

                // If a scenario is NOT applied to at least one non HTTP
                // binding,
                // we consider the service unsecured.
                if ((scenario == null)
                        && (!binding.getName().getLocalPart().contains("HttpBinding"))) {
                    break;
                }
            }

            // If the binding level policies are not present, check whether there is a policy attached
            // at the service level. This is a fix for Securing Proxy Services.
            if(scenario == null){
                java.util.Collection policies = service.getPolicySubject()
                        .getAttachedPolicyComponents();
                Iterator policyComponents = policies.iterator();
                String policyId = "";
                while (policyComponents.hasNext()) {
                    PolicyComponent currentPolicyComponent = (PolicyComponent) policyComponents
                            .next();
                    if (currentPolicyComponent instanceof Policy) {
                        policyId = ((Policy) currentPolicyComponent).getId();
                    } else if (currentPolicyComponent instanceof PolicyReference) {
                        policyId = ((PolicyReference) currentPolicyComponent).getURI().substring(1);
                    }
                    // Check whether this is a security scenario
                    scenario = SecurityScenarioDatabase.getByWsuId(policyId);
                }
            }

            return scenario;
        } catch (Exception e) {
            throw new SecurityConfigException("readingSecurity", e);
        }

    }
View Full Code Here

        if (!this.registry.resourceExists(servicePrincipalPasswordResource)) {
            String msg = "Unable to find service principle password registry resource in path "
                    + servicePrincipalPasswordResource;
            log.error(msg);
            throw new SecurityConfigException(msg);
        }

        org.wso2.carbon.registry.core.Resource principalPassword = this.registry.get(servicePrincipalPasswordResource);
        if (principalPassword != null) {
            String password = principalPassword.getProperty(KerberosConfig.SERVICE_PRINCIPLE_PASSWORD);
            if (password != null) {
                password = getDecryptedPassword(password);
                return password;
            } else {
                StringBuilder msg = new StringBuilder("Retrieved principal password is null in registry path ")
                        .append(servicePrincipalPasswordResource).append(" for property ")
                        .append(KerberosConfig.SERVICE_PRINCIPLE_PASSWORD);
                log.error(msg.toString());
                throw new SecurityConfigException(msg.toString());
            }
        } else {
            StringBuilder msg = new StringBuilder("Retrieved principal resource is null in registry path ")
                        .append(servicePrincipalPasswordResource).append(" for property ")
                        .append(KerberosConfig.SERVICE_PRINCIPLE_PASSWORD);
            log.error(msg.toString());
            throw new SecurityConfigException(msg.toString());
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.security.SecurityConfigException

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.