如何使用Gradle在Corda中为每个节点配置安全性? [英] How can I configure security per node in Corda using Gradle?

查看:57
本文介绍了如何使用Gradle在Corda中为每个节点配置安全性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Gradle将安全性属性添加到我的节点配置中。我正在尝试执行以下操作:

I want to add the security property to my node configuration using Gradle. I'm trying to do something like the below:

node {
name "O=Bank_A,L=New York,C=US"
p2pPort 10005
rpcSettings {
address("localhost:10006")
adminAddress("localhost:10046")
}
h2Port 9005
cordapps = [
"$project.group:bank-abc:$project.version",
"$project.group:shared-contracts-states:$project.version",
"$corda_release_group:corda-finance:$corda_release_version"
]

security = {
   authService = {
      dataSource = {
         type = "DB"
         passwordEncryption = "SHIRO_1_CRYPT"
         connection = {
             jdbcUrl = "jdbc:h2:tcp://10.0.75.1:9014/node"
             username = "some user"
             password = "some pass"
             driverClassName = "org.h2.Driver"
             }
          }
       }
    }
}

当我执行gradlew deployNodes时。我收到以下错误:

when I execute gradlew deployNodes. I get the below error:


  • 出了什么问题:

评估根项目'tbs-term-reciprocal-dapp'时发生问题。

A problem occurred evaluating root project 'tbs-term-reciprocal-dapp'.


无法设置未知属性安全性 '表示net.corda.plugins.Node类型的对象。

Could not set unknown property 'security' for object of type net.corda.plugins.Node.


推荐答案

安全配置,您需要在节点的Gradle脚本中使用extraConfig。

In order to add security config, you need to use extraConfig within your node's Gradle script.

以您的示例为例,extraConfig将如下所示:

Taking your example, the extraConfig will look like this:

extraConfig = [
    security : [
        authService : [
            dataSource : [
                type: "DB",
                passwordEncryption: "SHIRO_1_CRYPT",
                connection : [
                    jdbcUrl: "jdbc:h2:tcp://10.0.75.1:9014/node",
                    username: "sa",
                    password: "",
                    driverClassName: "org.h2.Driver"
                ]
            ]
        ]
    ]
]

这篇关于如何使用Gradle在Corda中为每个节点配置安全性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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