外部数据源不适用于安全的 WSO2 DSS 3.2.2 [英] External DataSources not working with secured WSO2 DSS 3.2.2

查看:18
本文介绍了外部数据源不适用于安全的 WSO2 DSS 3.2.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是在 WSO2_DSS_3.2.2 中部署为数据服务的示例 dbs 文件

Following is a sample dbs file which is deployed as dataservice in WSO2_DSS_3.2.2

<data name="login" serviceNamespace="www.abc.com/services/security" transports="http https">
  <description>security service</description>
  <config id="a_security">
    <property name="carbon_datasource_name">sample-ds</property>
  </config>
  <query id="login" useConfig="a_security">
     ...
  </query>
  <operation name="login">
    <call-query href="login">
       ...
    </call-query>
  </operation>
  <resource method="POST" path="login">
     ...
  </resource>
</data>

sample-ds 是从管理控制台设置的(保存在注册表中).这在新的 DSS 中运行良好,但是当我使用 DSS 应用证书时,出现以下错误.我用几个新的 DSS 副本尝试过这个,但在申请证书时也会发生同样的情况.

And sample-ds is setup from management console (its saved in registry). And this worked fine in a fresh DSS but when I applied a certificate with the DSS, it gives the following error. I tried this with several fresh DSS copies but same happens when applying the certificate.

ERROR {org.wso2.carbon.ndatasource.core.DataSourceRepository} -  Error in updating data source [remove:false] at path '/repository/components/org.wso2.carbon.ndatasource/mdl-psm-ds': Error in updating data source 'mdl-psm-ds' from registry [remove:false]: Error in secure load of data source meta info: errorDuringDecryption
org.wso2.carbon.ndatasource.common.DataSourceException: Error in updating data source 'mdl-psm-ds' from registry [remove:false]: Error in secure load of data source meta info: errorDuringDecryption
        at org.wso2.carbon.ndatasource.core.DataSourceRepository.updateDataSource(DataSourceRepository.java:186)
        at org.wso2.carbon.ndatasource.core.DataSourceRepository.updateAllUserDataSource(DataSourceRepository.java:135)
        at org.wso2.carbon.ndatasource.core.DataSourceRepository.refreshAllUserDataSources(DataSourceRepository.java:115)
        at org.wso2.carbon.ndatasource.core.DataSourceRepository.initRepository(DataSourceRepository.java:92)
        at org.wso2.carbon.ndatasource.core.DataSourceManager.initTenant(DataSourceManager.java:92)
        at org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent.initSuperTenantUserDataSources(DataSourceServiceComponent.java:189)
        at org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent.checkInitTenantUserDataSources(DataSourceServiceComponent.java:180)
        at org.wso2.carbon.ndatasource.core.internal.DataSourceServiceComponent.setRegistryService(DataSourceServiceComponent.java:131)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)

推荐答案

如果主要错误是 Caused by: org.wso2.carbon.core.util.CryptoException: A crypto service implementation has not been registered.,将下面的组件类添加到org.wso2.carbon.core 项目中:

If the main error is Caused by: org.wso2.carbon.core.util.CryptoException: A crypto service implementation has not been registered., add below component class to org.wso2.carbon.core project:

package org.wso2.carbon.core.internal;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.crypto.api.CryptoService;

/**
 * @scr.component name="carbon.core.dshcomponent" immediate="true"
 * @scr.reference name="carbonCryptoService" interface="org.wso2.carbon.crypto.api.CryptoService"
 * cardinality="0..1" policy="dynamic"  bind="setCarbonCryptoService" unbind="unsetCarbonCryptoService"
  */
public class CarbonCoreDataHolderHelperComponent {

    private static Log log = LogFactory.getLog(CarbonCoreDataHolderHelperComponent.class);

    private CarbonCoreDataHolder dataHolder = CarbonCoreDataHolder.getInstance();

    protected void activate(ComponentContext ctxt) {

    }

    protected void deactivate(ComponentContext ctxt) {

    }

    protected void setCarbonCryptoService(CryptoService cryptoService){
        if (log.isDebugEnabled()) {
            log.debug("crypto service loaded..");
        }
        dataHolder.setCryptoService(cryptoService);
    }

    protected void unsetCarbonCryptoService(CryptoService cryptoService){
        dataHolder.setCryptoService(null);
        if (log.isDebugEnabled()) {
            log.debug("crypto service unloaded..");
        }
    }

}

该组件将在用户数据源初始化之前绑定加密服务.

This Component will bind crypto service prior to user datasource initilization.

这篇关于外部数据源不适用于安全的 WSO2 DSS 3.2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆