除了权限管理之外,我的Corda应用程序运行良好。目前每个节点都可以启动流,但是这是不可能的。我试图限制build.gradle文件中某些节点的权限。这里有一个节点作为示例:
node {
name "O=PartyA,L=Paris,C=FR"
p2pPort 10008
rpcSettings {
address("localhost:10009")
adminAddress("localhost:10049")
}
rpcUsers = [[ user: "user2", password: "test", permissions: ["StartFlow.FlowInitiatorOne", "StartFlow.FlowInitiatorTwo"]]]
}我使用deployNodes命令部署网络。我的流是用Java编写的。无论权限如何,PartyA都能够启动所有流。PartyA的日志文件显示,在将权限添加到节点之前,所有流都已注册。
[INFO ] 2019-12-13T09:35:25,796Z [main] internal.NodeFlowManager.registerInitiatedFlow - Registered com.template.flows.FlowInitiatorOne to initiate com.template.flows.FlowResponderOne (version 1)
[INFO ] 2019-12-13T09:35:25,797Z [main] internal.NodeFlowManager.registerInitiatedFlow - Registered com.template.flows.FlowInitiatorTwo to initiate com.template.flows.FlowResponderTwo (version 1)
[INFO ] 2019-12-13T09:35:25,798Z [main] internal.NodeFlowManager.registerInitiatedFlow - Registered com.template.flows.FlowInitiatorThree to initiate com.template.flows.FlowResponderThree (version 1)
[INFO ] 2019-12-13T09:35:25,800Z [main] internal.NodeFlowManager.registerInitiatedFlow - Registered com.template.flows.FlowInitiatorFour to initiate com.template.flows.FlowResponderFour (version 1)
[INFO ] 2019-12-13T09:35:25,793Z [main] internal.NodeFlowManager.registerInitiatedFlow - Registered com.template.flows.FlowInitiatorFive to initiate com.template.flows.FlowResponderFive (version 1)在流注册下面,日志文件显示具有正确权限的用户。
[INFO ] 2019-12-13T09:35:55,434Z [main] security.RPCSecurityManagerImpl.buildImpl - Constructing realm from list of users in config [User(user2, permissions=[StartFlow.FlowInitiatorOne, StartFlow.FlowInitiatorTwo])]如果我在终端中输入flow list,PartyA会告诉我它可以启动所有五个流。我该如何解决这个问题?
发布于 2019-12-13 14:04:32
您的设置是正确的,您在日志中看到的也是有意义的。
cordapps文件夹并注册它看到的所有流。由于您正在直接连接到该节点(而不是通过ssh或使用standalone shell),而您的节点处于dev模式;然后Corda将您以用户shell的身份以密码shell连接到节点,您可以运行所有流。H 210H 111测试您的RPC用户,您必须编写一个客户端,使用test用户连接到您的节点;该客户端将仅限于调用您指定的2个流。了解访问节点的不同类型:https://docs.corda.net/shell.html
您可以在R3的cordapp中看到一个示例客户机(在Kotlin中):
调用流--运行该webserver的Gradle任务如何使用定义的RPC用户:https://github.com/corda/samples/blob/69ff8d4a668c520b6695be67864f4f96ab7ec809/cordapp-example/clients/build.gradle#L64
模板,并附带一个预定义的clients模块:https://github.com/corda/cordapp-template-java/tree/release-V4/clients/src/main/java/com/template/webserver
https://stackoverflow.com/questions/59320069
复制相似问题