Java源码示例:org.wso2.securevault.commons.MiscellaneousUtil

示例1
private static void secureLoadOMElement(OMElement element) {
	String alias = MiscellaneousUtil.getProtectedToken(element.getText());
	if (alias != null && !alias.isEmpty()) {
		element.setText(loadFromSecureVault(alias));
	} else {
		OMAttribute secureAttr = element.getAttribute(new QName(DataSourceConstants.SECURE_VAULT_NS,
				DataSourceConstants.SECRET_ALIAS_ATTR_NAME));
		if (secureAttr != null) {
			element.setText(loadFromSecureVault(secureAttr.getAttributeValue()));
			element.removeAttribute(secureAttr);
		}
	}
	Iterator<OMElement> childNodes = element.getChildElements();
	while (childNodes.hasNext()) {
		OMElement tmpNode = childNodes.next();
		secureLoadOMElement(tmpNode);
	}
}
 
示例2
private void readChildElements(OMElement serverConfig, Stack<String> nameStack) {

		for (Iterator childElements = serverConfig.getChildElements(); childElements.hasNext(); ) {
			OMElement element = (OMElement) childElements.next();
			nameStack.push(element.getLocalName());
			if (elementHasText(element)) {
				String key = getKey(nameStack);
				String value;
				String resolvedValue = MiscellaneousUtil.resolve(element, secretResolver);

				if (resolvedValue != null && !resolvedValue.isEmpty()) {
					value = resolvedValue;
				} else {
					value = element.getText();
				}
				value = resolveSystemProperty(value);
				addToConfiguration(key, value);
			}
			readChildElements(element, nameStack);
			nameStack.pop();
		}
	}
 
示例3
/**
 * There can be sensitive information like passwords in configuration file. If they are encrypted using secure
 * vault, this method will resolve them and replace with original values.
 */
private void resolveSecrets() {

    SecretResolver secretResolver = SecretResolverFactory.create(notificationMgtConfigProperties);
    Enumeration propertyNames = notificationMgtConfigProperties.propertyNames();

    // Iterate through whole config file and find encrypted properties and resolve them
    if (secretResolver != null && secretResolver.isInitialized()) {
        for (Map.Entry<Object, Object> entry : notificationMgtConfigProperties.entrySet()) {
            String key = entry.getKey().toString();
            String value = entry.getValue().toString();
            if (value != null) {
                value = MiscellaneousUtil.resolve(value, secretResolver);
            }
            notificationMgtConfigProperties.put(key, value);
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Secret Resolver is not present. Will not resolve encryptions in config file");
        }
    }
}
 
示例4
/**
 * There can be sensitive information like passwords in configuration file. If they are encrypted using secure
 * vault, this method will resolve them and replace with original values.
 */
private void resolveSecrets() {

    SecretResolver secretResolver = SecretResolverFactory.create(notificationMgtConfigProperties);
    Enumeration propertyNames = notificationMgtConfigProperties.propertyNames();
    // Iterate through whole config file and find encrypted properties and resolve them
    if (secretResolver != null && secretResolver.isInitialized()) {
        for (Map.Entry<Object, Object> entry : notificationMgtConfigProperties.entrySet()) {
            String key = entry.getKey().toString();
            String value = entry.getValue().toString();
            if (value != null) {
                value = MiscellaneousUtil.resolve(value, secretResolver);
            }
            notificationMgtConfigProperties.put(key, value);
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Secret Resolver is not present. Will not resolve encryptions in config file");
        }
    }

}
 
示例5
private void loadProperties(OMElement executorElem, Object workflowClass) throws WorkflowException {

        for (Iterator it = executorElem.getChildrenWithName(PROP_Q); it.hasNext(); ) {
            OMElement propertyElem = (OMElement) it.next();
            OMAttribute attribute = propertyElem.getAttribute(ATT_NAME);
            if (attribute == null) {
                handleException("An Executor class property must specify the name attribute");
            } else {
                String propName = attribute.getAttributeValue();
                OMNode omElt = propertyElem.getFirstElement();
                if (omElt != null) {
                    setInstanceProperty(propName, omElt, workflowClass);
                } else if (propertyElem.getText() != null) {
                    String value = MiscellaneousUtil.resolve(propertyElem, secretResolver);
                    setInstanceProperty(propName, value, workflowClass);
                } else {
                    handleException("An Executor class property must specify " +
                            "name and text value, or a name and a child XML fragment");
                }
            }
        }
    }
 
示例6
private Map<String, String> getChildPropertyElements(OMElement omElement,
                                                     SecretResolver secretResolver) {
    Map<String, String> map = new HashMap<String, String>();
    Iterator<?> ite = omElement.getChildrenWithName(new QName(
            UserCoreConstants.RealmConfig.LOCAL_NAME_PROPERTY));
    while (ite.hasNext()) {
        OMElement propElem = (OMElement) ite.next();
        String propName = propElem.getAttributeValue(new QName(
                UserCoreConstants.RealmConfig.ATTR_NAME_PROP_NAME));
        String propValue = MiscellaneousUtil.resolve(propElem, secretResolver);
        map.put(propName.trim(), propValue.trim());
    }
    return map;
}
 
示例7
private void initCipherDecryptProvider() {
	if(decryptionProvider !=null) return;
	Properties properties = SecureVaultUtil.loadProperties();

	// Load algorithm
	String algorithm = getCipherTransformation(properties);

	// Load keyStore
	String buffer = DOT + KEY_STORE;
	String keyStore = MiscellaneousUtil.getProperty(properties, buffer, null);

	KeyStoreWrapper keyStoreWrapper;

	if (TRUSTED.equals(keyStore)) {
		keyStoreWrapper = trustKeyStoreWrapper;

	} else {
		keyStoreWrapper = identityKeyStoreWrapper;
	}

	CipherInformation cipherInformation = new CipherInformation();
	cipherInformation.setAlgorithm(algorithm);
	cipherInformation.setCipherOperationMode(CipherOperationMode.DECRYPT);
	cipherInformation.setInType(EncodingType.BASE64); // TODO
	decryptionProvider = CipherFactory.createCipher(cipherInformation, keyStoreWrapper);

}
 
示例8
/**
 * Get the Cipher Transformation to be used by the Cipher. We have the option of configuring this globally as a
 * System Property '-Dorg.wso2.CipherTransformation', which can be overridden at the 'secret-conf.properties' level
 * by specifying the property 'keystore.identity.CipherTransformation'. If neither are configured the default 'RSA'
 * will be used
 *
 * @param properties Properties from the 'secret-conf.properties' file
 * @return Cipher Transformation String
 */
private String getCipherTransformation(Properties properties) {
	String cipherTransformation = System.getProperty(CIPHER_TRANSFORMATION_SYSTEM_PROPERTY);

	if (cipherTransformation == null) {
		cipherTransformation = DEFAULT_ALGORITHM;
	}

	return MiscellaneousUtil.getProperty(properties, CIPHER_TRANSFORMATION_SECRET_CONF_PROPERTY,
			cipherTransformation);
}
 
示例9
private void readChildElements(OMElement serverConfig, Stack<String> nameStack) {
    for (Iterator childElements = serverConfig.getChildElements(); childElements.hasNext(); ) {
        OMElement element = (OMElement) childElements.next();
        nameStack.push(element.getLocalName());
        if (elementHasText(element)) {
            String key = getKey(nameStack);
            Object currentObject = configuration.get(key);
            String value;
            String resolvedValue = MiscellaneousUtil.resolve(element, secretResolver);

            if (StringUtils.isNotBlank(resolvedValue)) {
                value = resolvedValue;
            } else {
                value = element.getText();
            }
            value = replaceSystemProperty(value);

            if (currentObject == null) {
                configuration.put(key, value);
            } else if (currentObject instanceof ArrayList) {
                List list = (ArrayList) currentObject;
                if (!list.contains(value)) {
                    list.add(value);
                }
            } else {
                if (!value.equals(currentObject)) {
                    List arrayList = new ArrayList(2);
                    arrayList.add(currentObject);
                    arrayList.add(value);
                    configuration.put(key, arrayList);
                }
            }
        }
        readChildElements(element, nameStack);
        nameStack.pop();
    }
}
 
示例10
private static void resolveSecrets(Properties properties) {

        SecretResolver secretResolver = SecretResolverFactory.create(properties);
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            String key = entry.getKey().toString();
            String value = entry.getValue().toString();
            if (value != null) {
                value = MiscellaneousUtil.resolve(value, secretResolver);
            }
            properties.put(key, value);
        }
    }
 
示例11
private Map<String, String> getChildPropertyElements(OMElement omElement, SecretResolver secretResolver)
        throws org.wso2.micro.integrator.security.user.api.UserStoreException {
    String domainName = "";
    try {
        AXIOMXPath xPath = new AXIOMXPath(UserCoreConstants.RealmConfig.DOMAIN_NAME_XPATH);
        OMElement val = (OMElement) xPath.selectSingleNode(omElement);
        if (val != null) {
            domainName = "." + val.getText();
        }
    } catch (Exception e) {
        log.debug("Error While getting DomainName from Configurations ");
    }

    Map<String, String> map = new HashMap<String, String>();
    Iterator<?> ite = omElement.getChildrenWithName(new QName(
            UserCoreConstants.RealmConfig.LOCAL_NAME_PROPERTY));
    boolean tokenProtected = false;
    while (ite.hasNext()) {
        OMElement propElem = (OMElement) ite.next();
        String propName = propElem.getAttributeValue(new QName(
                UserCoreConstants.RealmConfig.ATTR_NAME_PROP_NAME));
        String propValue = propElem.getText();
        if (secretResolver != null && secretResolver.isInitialized()) {
            String alias = MiscellaneousUtil.getProtectedToken(propValue);
            if (StringUtils.isNotEmpty(alias) && secretResolver.isTokenProtected(alias)) {
                propValue = secretResolver.resolve(alias);
                tokenProtected = true;
            } else {
                if (secretResolver.isTokenProtected("UserManager.Configuration.Property."
                        + propName + domainName)) {
                    propValue = secretResolver.resolve("UserManager.Configuration.Property."
                            + propName + domainName);
                    tokenProtected = true;
                }
                if (secretResolver.isTokenProtected("UserStoreManager.Property." + propName + domainName)) {
                    propValue = secretResolver.resolve("UserStoreManager.Property." + propName + domainName);
                    tokenProtected = true;
                }
            }

        }
        if (!tokenProtected && propValue != null) {
            propValue = resolveEncryption(propElem);
        }
        tokenProtected = false;
        if (propName != null && propValue != null) {
            map.put(propName.trim(), propValue.trim());
        }

    }
    return map;
}
 
示例12
/**
 * There can be sensitive information like passwords in configuration file. If they are encrypted using secure
 * vault, this method will resolve them and replace with original values.
 */
private static void resolveSecrets(Properties properties) {

    String secretProvider = (String) properties.get(SECRET_PROVIDER);
    if (StringUtils.isBlank(secretProvider)) {
        properties.put(SECRET_PROVIDER, DEFAULT_CALLBACK_HANDLER);
    }
    SecretResolver secretResolver = SecretResolverFactory.create(properties);
    if (secretResolver != null && secretResolver.isInitialized()) {
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            String key = entry.getKey().toString();
            String value = entry.getValue().toString();
            if (value != null) {
                value = MiscellaneousUtil.resolve(value, secretResolver);
            }
            properties.put(key, value);
        }
    }
    // Support the protectedToken alias used for encryption. ProtectedToken alias is deprecated.
    if (isSecuredPropertyAvailable(properties)) {
        SecretResolver resolver = SecretResolverFactory.create(properties, "");
        String protectedTokens = (String) properties.get(PROTECTED_TOKENS);
        StringTokenizer st = new StringTokenizer(protectedTokens, ",");
        while (st.hasMoreElements()) {
            String element = st.nextElement().toString().trim();

            if (resolver.isTokenProtected(element)) {
                if (log.isDebugEnabled()) {
                    log.debug("Resolving and replacing secret for " + element);
                }
                // Replaces the original encrypted property with resolved property.
                properties.put(element, resolver.resolve(element));
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("No encryption done for value with key :" + element);
                }
            }
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Secure vault encryption ignored since no protected tokens available");
        }
    }
}
 
示例13
/**
 * There can be sensitive information like passwords in configuration file. If they are encrypted using secure
 * vault, this method will resolve them and replace with original values.
 */
private static void resolveSecrets(Properties properties) {

    String secretProvider = (String) properties.get(SECRET_PROVIDER);
    if (StringUtils.isBlank(secretProvider)) {
        properties.put(SECRET_PROVIDER, DEFAULT_CALLBACK_HANDLER);
    }
    SecretResolver secretResolver = SecretResolverFactory.create(properties);
    if (secretResolver != null && secretResolver.isInitialized()) {
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            String key = entry.getKey().toString();
            String value = entry.getValue().toString();
            if (value != null) {
                value = MiscellaneousUtil.resolve(value, secretResolver);
            }
            properties.put(key, value);
        }
    }
    // Support the protectedToken alias used for encryption. ProtectedToken alias is deprecated.
    if (isSecuredPropertyAvailable(properties)) {
        SecretResolver resolver = SecretResolverFactory.create(properties, "");
        String protectedTokens = (String) properties.get(PROTECTED_TOKENS);
        StringTokenizer st = new StringTokenizer(protectedTokens, ",");
        while (st.hasMoreElements()) {
            String element = st.nextElement().toString().trim();

            if (resolver.isTokenProtected(element)) {
                if (log.isDebugEnabled()) {
                    log.debug("Resolving and replacing secret for " + element);
                }
                // Replaces the original encrypted property with resolved property
                properties.put(element, resolver.resolve(element));
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("No encryption done for value with key :" + element);
                }
            }
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Secure vault encryption ignored since no protected tokens available");
        }
    }
}
 
示例14
/**
 * There can be sensitive information like passwords in configuration file. If they are encrypted using secure
 * vault, this method will resolve them and replace with original values.
 */
private static void resolveSecrets(Properties properties) {

    String secretProvider = (String) properties.get(SECRET_PROVIDER);
    if (StringUtils.isBlank(secretProvider)) {
        properties.put(SECRET_PROVIDER, DEFAULT_CALLBACK_HANDLER);
    }
    SecretResolver secretResolver = SecretResolverFactory.create(properties);
    if (secretResolver != null && secretResolver.isInitialized()) {
        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
            String key = entry.getKey().toString();
            String value = entry.getValue().toString();
            if (value != null) {
                value = MiscellaneousUtil.resolve(value, secretResolver);
            }
            properties.put(key, value);
        }
    }
    // Support the protectedToken alias used for encryption. ProtectedToken alias is deprecated.
    if (isSecuredPropertyAvailable(properties)) {
        SecretResolver resolver = SecretResolverFactory.create(properties, "");
        String protectedTokens = (String) properties.get(PROTECTED_TOKENS);
        StringTokenizer st = new StringTokenizer(protectedTokens, ",");
        while (st.hasMoreElements()) {
            String element = st.nextElement().toString().trim();

            if (resolver.isTokenProtected(element)) {
                if (log.isDebugEnabled()) {
                    log.debug("Resolving and replacing secret for " + element);
                }
                // Replaces the original encrypted property with resolved property.
                properties.put(element, resolver.resolve(element));
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("No encryption done for value with key :" + element);
                }
            }
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Secure vault encryption ignored since no protected tokens available");
        }
    }
}
 
示例15
private void setGlobalCacheInvalidationConfiguration(OMElement element) {

        CacheInvalidationConfiguration cacheInvalidationConfiguration = new CacheInvalidationConfiguration();
        OMElement enabledElement =
                element.getFirstChildWithName(new QName(APIConstants.GlobalCacheInvalidation.ENABLED));
        if (enabledElement != null) {
            cacheInvalidationConfiguration.setEnabled(Boolean.parseBoolean(enabledElement.getText()));
        }
        OMElement domainElement = element.getFirstChildWithName(new QName(APIConstants.GlobalCacheInvalidation.Domain));
        if (domainElement != null) {
            cacheInvalidationConfiguration.setDomain(domainElement.getText());
        }
        OMElement streamNameElement =
                element.getFirstChildWithName(new QName(APIConstants.GlobalCacheInvalidation.Stream));
        if (streamNameElement != null) {
            cacheInvalidationConfiguration.setStream(streamNameElement.getText());
        }
        OMElement usernameElement = element.getFirstChildWithName
                (new QName(APIConstants.GlobalCacheInvalidation.USERNAME));
        if (usernameElement != null) {
            cacheInvalidationConfiguration.setUsername(APIUtil.replaceSystemProperty(usernameElement.getText()));
        }
        String password;
        OMElement passwordElement =
                element.getFirstChildWithName(new QName(APIConstants.GlobalCacheInvalidation.PASSWORD));
        if (passwordElement != null) {
            password = MiscellaneousUtil.resolve(passwordElement, secretResolver);
            cacheInvalidationConfiguration.setPassword(APIUtil.replaceSystemProperty(password));
        }
        OMElement receiverUrlGroupElement =
                element.getFirstChildWithName(new QName(APIConstants.GlobalCacheInvalidation.REVEIVER_URL_GROUP));
        if (receiverUrlGroupElement != null) {
            cacheInvalidationConfiguration
                    .setReceiverUrlGroup(APIUtil.replaceSystemProperty(receiverUrlGroupElement.getText()));
        }
        OMElement authUrlGroupElement =
                element.getFirstChildWithName(new QName(APIConstants.GlobalCacheInvalidation.AUTH_URL_GROUP));
        if (authUrlGroupElement != null) {
            cacheInvalidationConfiguration
                    .setAuthUrlGroup(APIUtil.replaceSystemProperty(authUrlGroupElement.getText()));
        }
        OMElement receiverConnectionDetailsElement =
                element.getFirstChildWithName(
                        new QName(APIConstants.GlobalCacheInvalidation.ReceiverConnectionDetails));
        if (receiverConnectionDetailsElement != null) {
            Iterator receiverConnectionDetailsElements = receiverConnectionDetailsElement.getChildElements();
            Properties properties = new Properties();
            while (receiverConnectionDetailsElements.hasNext()) {
                OMElement omElement = (OMElement) receiverConnectionDetailsElements.next();
                String value = MiscellaneousUtil.resolve(omElement, secretResolver);
                properties.put(omElement.getLocalName(), APIUtil.replaceSystemProperty(value));
            }
            cacheInvalidationConfiguration.setJmsConnectionParameters(properties);
        }
        OMElement topicNameElement =
                element.getFirstChildWithName(new QName(APIConstants.GlobalCacheInvalidation.TOPIC_NAME));
        if (topicNameElement != null) {
            cacheInvalidationConfiguration.setCacheInValidationTopic(topicNameElement.getText());
        }
        OMElement excludedCachesElement =
                element.getFirstChildWithName(new QName(APIConstants.GlobalCacheInvalidation.EXCLUDED_CACHES));
        if (excludedCachesElement != null) {
            Iterator excludedCaches = excludedCachesElement.getChildElements();
            while (excludedCaches.hasNext()) {
                cacheInvalidationConfiguration.addExcludedCaches(((OMElement) excludedCaches.next()).getText());
            }
        }
        this.cacheInvalidationConfiguration = cacheInvalidationConfiguration;
    }
 
示例16
/**
 * set workflow related configurations
 *
 * @param element
 */
private void setWorkflowProperties(OMElement element) {

    OMElement workflowConfigurationElement = element
            .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW));
    if (workflowConfigurationElement != null) {
        OMElement enableWorkflowElement = workflowConfigurationElement
                .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW_ENABLED));
        if (enableWorkflowElement != null) {
            workflowProperties.setEnabled(JavaUtils.isTrueExplicitly(enableWorkflowElement.getText()));
        }
        OMElement workflowServerUrlElement = workflowConfigurationElement
                .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW_SERVER_URL));
        if (workflowServerUrlElement != null) {
            workflowProperties.setServerUrl(APIUtil.replaceSystemProperty(workflowServerUrlElement.getText()));
        }
        OMElement workflowServerUserElement = workflowConfigurationElement
                .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW_SERVER_USER));
        if (workflowServerUserElement != null) {
            workflowProperties.setServerUser(APIUtil.replaceSystemProperty(workflowServerUserElement.getText()));
        }
        OMElement workflowDCRUserElement = workflowConfigurationElement
                .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW_DCR_EP_USER));
        if (workflowDCRUserElement != null) {
            workflowProperties.setdCREndpointUser(APIUtil.replaceSystemProperty(workflowDCRUserElement.getText()));
        }
        OMElement workflowCallbackElement = workflowConfigurationElement
                .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW_CALLBACK));
        if (workflowCallbackElement != null) {
            workflowProperties
                    .setWorkflowCallbackAPI(APIUtil.replaceSystemProperty(workflowCallbackElement.getText()));
        }

        OMElement workflowDCREPElement = workflowConfigurationElement
                .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW_DCR_EP));
        if (workflowDCREPElement != null) {
            workflowProperties.setdCREndPoint(APIUtil.replaceSystemProperty(workflowDCREPElement.getText()));
        }

        OMElement workflowTokenEpElement = workflowConfigurationElement
                .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW_TOKEN_EP));
        if (workflowTokenEpElement != null) {
            workflowProperties.setTokenEndPoint(APIUtil.replaceSystemProperty(workflowTokenEpElement.getText()));
        }
        OMElement workflowServerPasswordOmElement = workflowConfigurationElement
                .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW_SERVER_PASSWORD));
        String workflowServerPassword = MiscellaneousUtil.resolve(workflowServerPasswordOmElement, secretResolver);
        workflowServerPassword = APIUtil.replaceSystemProperty(workflowServerPassword);
        workflowProperties.setServerPassword(workflowServerPassword);

        OMElement dcrEPPasswordOmElement = workflowConfigurationElement
                .getFirstChildWithName(new QName(APIConstants.WorkflowConfigConstants.WORKFLOW_DCR_EP_PASSWORD));
        String dcrEPPassword = MiscellaneousUtil.resolve(dcrEPPasswordOmElement, secretResolver);
        dcrEPPassword = APIUtil.replaceSystemProperty(dcrEPPassword);
        workflowProperties.setdCREndpointPassword(dcrEPPassword);

    }
}
 
示例17
private void setEventHubConfiguration(OMElement omElement) {

        EventHubConfigurationDto eventHubConfigurationDto = new EventHubConfigurationDto();
        OMElement enableElement = omElement.getFirstChildWithName(new QName(APIConstants.KeyManager.ENABLE));
        if (enableElement != null && Boolean.parseBoolean(enableElement.getText())) {
            eventHubConfigurationDto.setEnabled(true);
            OMElement serviceUrl = omElement.getFirstChildWithName(new QName(APIConstants.KeyManager.SERVICE_URL));
            if (serviceUrl != null) {
                eventHubConfigurationDto.setServiceUrl(
                        APIUtil.replaceSystemProperty(serviceUrl.getText()).concat(APIConstants.INTERNAL_WEB_APP_EP));
            }
            OMElement initDelay = omElement.getFirstChildWithName(new QName(APIConstants.KeyManager.INIT_DELAY));
            if (initDelay != null) {
                eventHubConfigurationDto.setInitDelay(Integer.parseInt(initDelay.getText()));
            }
            OMElement usernameElement = omElement.getFirstChildWithName(new QName(APIConstants.KeyManager.USERNAME));
            if (usernameElement != null) {
                eventHubConfigurationDto.setUsername(usernameElement.getText());
            }
            OMElement passwordElement = omElement.getFirstChildWithName(new QName(APIConstants.KeyManager.PASSWORD));
            if (passwordElement != null) {
                String password = MiscellaneousUtil.resolve(passwordElement, secretResolver);
                eventHubConfigurationDto.setPassword(APIUtil.replaceSystemProperty(password).toCharArray());
            }

            OMElement configurationRetrieverElement =
                    omElement.getFirstChildWithName(new QName(APIConstants.KeyManager.EVENT_RECEIVER_CONFIGURATION));
            if (configurationRetrieverElement != null) {
                EventHubConfigurationDto.EventHubReceiverConfiguration eventHubReceiverConfiguration =
                        new EventHubConfigurationDto.EventHubReceiverConfiguration();
                Iterator receiverConnectionDetailsElements = configurationRetrieverElement.getChildElements();
                Properties properties = new Properties();
                while (receiverConnectionDetailsElements.hasNext()) {
                    OMElement element = (OMElement) receiverConnectionDetailsElements.next();
                    String value = MiscellaneousUtil.resolve(element, secretResolver);
                    properties.put(element.getLocalName(), APIUtil.replaceSystemProperty(value));
                }
                eventHubReceiverConfiguration.setJmsConnectionParameters(properties);
                eventHubConfigurationDto.setEventHubReceiverConfiguration(eventHubReceiverConfiguration);
            }
            OMElement eventPublisherElement =
                    omElement.getFirstChildWithName(new QName(APIConstants.KeyManager.EVENT_PUBLISHER_CONFIGURATIONS));
            EventHubConfigurationDto.EventHubPublisherConfiguration eventHubPublisherConfiguration =
                    new EventHubConfigurationDto.EventHubPublisherConfiguration();
            if (eventPublisherElement != null) {
                OMElement receiverUrlGroupElement = eventPublisherElement.getFirstChildWithName(new
                        QName
                        (APIConstants.AdvancedThrottleConstants.DATA_PUBLISHER_CONFIGURAION_REVEIVER_URL_GROUP));
                if (receiverUrlGroupElement != null) {
                    eventHubPublisherConfiguration
                            .setReceiverUrlGroup(APIUtil.replaceSystemProperty(receiverUrlGroupElement
                                    .getText()));
                }
                OMElement authUrlGroupElement = eventPublisherElement.getFirstChildWithName(new QName
                        (APIConstants.AdvancedThrottleConstants.DATA_PUBLISHER_CONFIGURAION_AUTH_URL_GROUP));
                if (authUrlGroupElement != null) {
                    eventHubPublisherConfiguration
                            .setAuthUrlGroup(APIUtil.replaceSystemProperty(authUrlGroupElement.getText()));
                }
                OMElement eventTypeElement = eventPublisherElement.getFirstChildWithName(
                        new QName(APIConstants.AdvancedThrottleConstants.DATA_PUBLISHER_CONFIGURAION_TYPE));
                if (eventTypeElement != null) {
                    eventHubPublisherConfiguration.setType(eventTypeElement.getText().trim());
                }
                eventHubConfigurationDto.setEventHubPublisherConfiguration(eventHubPublisherConfiguration);
            }
        }
        this.eventHubConfigurationDto = eventHubConfigurationDto;
    }