How can I configure security per node in Corda using Gradle?

假装没事ソ 提交于 2019-12-06 14:57:33

问题


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"
             }
          }
       }
    }
}

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

  • What went wrong:

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

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


回答1:


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

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"
                ]
            ]
        ]
    ]
]


来源:https://stackoverflow.com/questions/51636785/how-can-i-configure-security-per-node-in-corda-using-gradle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!