Package org.wso2.carbon.registry.core

Examples of org.wso2.carbon.registry.core.Registry


        try {
            String secretKey = UUID.randomUUID().toString();

            //User suppose to give where he wants to store interemdiate data to them after confirmation
            //here there's not tenant registration happened yet so get the super tenant registry instance
            Registry registry = Util.getConfigSystemRegistry(0);
            Resource resource = registry.newResource();
            // store the redirector url
            resource.setProperty("redirectPath", serviceConfig.getRedirectPath());
            // store the user data, redirectPath can be overwritten here.
            for (String s : data.keySet()) {
                resource.setProperty(s, data.get(s));
            }

            ((ResourceImpl)resource).setVersionableChange(false);
            String secretKeyPath = EMAIL_VERIFICATION_COLLECTION + "/" + secretKey;
            registry.put(secretKeyPath, resource);
            // sending the mail
            EmailSender sender = new EmailSender(serviceConfig, emailAddress, secretKey,
                    SuperTenantCarbonContext.getCurrentContext().getTenantDomain(true), data);
            sender.sendEmail();
        } catch (Exception e) {
View Full Code Here


        CardIssuerDTO dto = null;
        IdentityPersistenceManager dbAmin = null;
        ParameterDO param = null;
        ArrayList<CardIssuerTokenDTO> supportedTokens = null;
        String[] tokens = null;
        Registry registry = null;

        dbAmin = IdentityPersistenceManager.getPersistanceManager();
        dto = new CardIssuerDTO();
        registry = IdentityTenantUtil.getRegistry();
View Full Code Here

            } else {
                notSupportedBuffer.append(getUri(supportedTokens[i].getTokenType()));
            }
        }

        Registry registry = null;
        registry = IdentityTenantUtil.getRegistry();

        dbAmin.createOrUpdateParameter(registry, IdentityConstants.PARAM_SUPPORTED_TOKEN_TYPES,
                supportedBuffer.toString());
        dbAmin.createOrUpdateParameter(IdentityTenantUtil.getRegistry(),
View Full Code Here

     *
     * @throws Exception
     */
    private void loadSecurityScenarios() throws Exception {

        Registry registry = registryService.getConfigSystemRegistry();

        try {
            // Scenarios are listed in resources/scenario-config.xml
            URL resource = bundleContext.getBundle().getResource("scenario-config.xml");
            XmlConfiguration xmlConfiguration = new XmlConfiguration(resource.openStream(),
                    SecurityConstants.SECURITY_NAMESPACE);

            OMElement[] elements = xmlConfiguration.getElements("//ns:Scenario");

            boolean transactionStarted = Transaction.isStarted();
            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);

                // Store the scenario in the Registry
                if (!scenarioId.equals(SecurityConstants.SCENARIO_DISABLE_SECURITY) &&
                        !scenarioId.equals(SecurityConstants.POLICY_FROM_REG_SCENARIO)) {
                    Resource scenarioResource = new ResourceImpl();
                    scenarioResource.setContentStream(
                            bundleContext.getBundle().getResource(scenarioId + "-policy.xml").openStream());
                    if (!registry.resourceExists(resourceUri)) {
                        registry.put(resourceUri, scenarioResource);
                    }
                }

            }
            if (!transactionStarted) {
                registry.commitTransaction();
            }
        } catch (Exception e) {
            registry.rollbackTransaction();
            throw e;
        }
    }
View Full Code Here

    }

    public String[] getAvailableActions(RequestContext context) {
        try {
            if (states.size() == 0) {
                Registry registry = context.getRegistry();
                String xmlContent = "";
                if (isConfigurationFromResource) {
                    Resource configurationResource = registry.get(configurationResourcePath);
                    xmlContent = new String((byte[])configurationResource.getContent());
                    configurationElement =  AXIOMUtil.stringToOM(xmlContent);
                }

                Iterator stateElements = configurationElement.getChildElements();
View Full Code Here

     * @throws RegistryException
     */
    private String getUserName(String ppid, String tenantDomain) throws IdentityException,
            RegistryException, CarbonException {
        String username = null;
        Registry registry = null;
       
        String superTenant = IdentityConstants.DEFAULT_SUPER_TENAT;
       
        if (tenantDomain == null || tenantDomain.equals(superTenant)) {
            // if domain is null then check for the super tenant
View Full Code Here

        String username = OpenIDUtil.getUserName(papeInfoRequestDto.getOpenID());

        AuthRequest authReq = null;
        ServerManager manager = null;
        String domainName = null;
        Registry registry;
        String tenatUser = null;

        try {
            manager = OpenIDProvider.getInstance().getManager();
            authReq = AuthRequest.createAuthRequest(paramList, manager.getRealmVerifier());
View Full Code Here

           
            String username = data.getPrincipal().getName();
            if(log.isDebugEnabled()){
                log.debug("Recieved " + username);
            }
            Registry registry = AnonymousSessionUtil.getSystemRegistryByUserName(
                    IdentitySTSServiceComponent.getRegistryService(), IdentitySTSServiceComponent
                            .getRealmService(), username);
            isValidCard = isValidCard(ipData.getCardID(), registry);

            if (log.isDebugEnabled()) {
View Full Code Here

                        + axisService.getAxisServiceGroup().getServiceGroupName()
                        + RegistryResources.SERVICES + serviceName;

                String policyResourcePath = servicePath + RegistryResources.POLICIES;
                int tenantID = SuperTenantCarbonContext.getCurrentContext(axisService).getTenantId();
                Registry registry = SecurityServiceHolder.getRegistryService()
                        .getConfigSystemRegistry(tenantID);
                if (!registry.resourceExists(policyResourcePath)) {
                    // do nothing, because no policy
                    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());
View Full Code Here

            throw e;
        }
    }

    private void addKeystores() throws Exception {
        Registry registry = SecurityServiceHolder.getRegistryService().getGovernanceSystemRegistry();
        try {
            boolean transactionStarted = Transaction.isStarted();
            if (!transactionStarted) {
                registry.beginTransaction();
            }
            if (!registry.resourceExists(SecurityConstants.KEY_STORES)) {
                Collection kstores = registry.newCollection();
                registry.put(SecurityConstants.KEY_STORES, kstores);

                Resource primResource = registry.newResource();
                if (!registry.resourceExists(RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE)) {
                    registry.put(RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE,
                                 primResource);
                }
            }
            if (!transactionStarted) {
                registry.commitTransaction();
            }
        } catch (Exception e) {
            registry.rollbackTransaction();
            throw e;
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.Registry

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.