Corda webserver produces exception “User not authorized to perform RPC call nodeInfo with target”

一笑奈何 提交于 2020-01-06 04:41:29

问题


I am trying to restrict a node to perform certain flow,

For Example, I have two flows FlowOne and FlowTwo.

For PartyA, I want to give permission for FlowOne,

For PartyB permission for FlowTwo.

Permission to the rpc calls should be there also.

Here is my rpcUsers configuration

PartyA: rpcUsers = [[ user: "user1", "password": "test", "permissions": ["StartFlow.net.corda.mortgage.msr.flows.FlowOne","InvokeRpc.startFlow"]]]

PartyB: rpcUsers = [[ user: "user2", "password": "test", "permissions": ["StartFlow.net.corda.mortgage.msr.flows.FlowTwo","InvokeRpc.startFlow"]]]

I am not sure What I am missing in the permissions. Any suggestions are always welcome


回答1:


At start-up, the Corda webserver makes an RPC call to retrieve the NodeInfo of the node it is connecting to. It needs to explicitly be given the permission to make this call.

You do this by giving the RPC user:

  • The InvokeRpc.nodeInfo permission (you give an RPC user the permission to perform a given RPC operation by adding a permission of the form InvokeRpc.[RPC method name])
  • The ALL permission (this gives the RPC user all permissions)

If you're starting the nodes via deployNodes, you add the permission as follows:

rpcUsers = [[user: "user1", "password": "test", "permissions": ["InvokeRpc.nodeInfo"]]]

Or:

rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]

If you're starting the nodes via the node driver (as seen here: https://github.com/corda/cordapp-example/blob/release-V3/kotlin-source/src/test/kotlin/com/example/NodeDriver.kt), you add the permission as follows:

val user = User("user1", "test", permissions = setOf("InvokeRpc.nodeInfo"))

Or:

val user = User("user1", "test", permissions = setOf("ALL"))


来源:https://stackoverflow.com/questions/50056621/corda-webserver-produces-exception-user-not-authorized-to-perform-rpc-call-node

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