Corda Web服务器会生成异常“未授权用户执行与目标的RPC调用nodeInfo". [英] Corda webserver produces exception "User not authorized to perform RPC call nodeInfo with target"

查看:88
本文介绍了Corda Web服务器会生成异常“未授权用户执行与目标的RPC调用nodeInfo".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图限制节点执行某些流程,

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

例如,我有两个流程FlowOne和FlowTwo.

For Example, I have two flows FlowOne and FlowTwo.

对于PartyA,我要授予FlowOne许可,

For PartyA, I want to give permission for FlowOne,

获得FlowTwo的PartyB许可.

For PartyB permission for FlowTwo.

也应该有rpc调用权限.

Permission to the rpc calls should be there also.

这是我的 rpcUsers 配置

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

推荐答案

在启动时,Corda Web服务器进行RPC调用以检索其连接到的节点的 NodeInfo .需要明确地授予进行此调用的权限.

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.

您可以通过为RPC用户提供权限来实现这一点:

You do this by giving the RPC user:

  • InvokeRpc.nodeInfo 权限(通过添加格式为 InvokeRpc.[RPC方法名称] 的权限,为RPC用户授予执行给定RPC操作的权限.)
  • ALL 权限(这为RPC用户提供了所有权限)
  • 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)

如果要通过 deployNodes 启动节点,请按如下所示添加权限:

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

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

或者:

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

或者:

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

这篇关于Corda Web服务器会生成异常“未授权用户执行与目标的RPC调用nodeInfo".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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