跳转至

多方合作权限管理

1. 说明

  • fateflow权限认证支持flow自身鉴权和第三方鉴权两种方式

  • 鉴权配置: $FATE_BASE/conf/service_conf.yaml

hook_module:
  permission: fate_flow.hook.flow.permission
hook_server_name:
permission:
  switch: false
  component: false
  dataset: false
其中,权限钩子支持"fate_flow.hook.flow.permission"和"fate_flow.hook.api.permission"两种

2. 权限认证

2.1 flow权限认证

2.1.1 认证方案

  • flow权限认证方案使用casbin权限控制框架,支持组件和数据集两种权限。
  • 配置如下:
      hook_module:
        permission: fate_flow.hook.flow.permission
      permission:
        switch: true
        component: true
        dataset: true
    

2.1.2 授权

添加权限

flow privilege grant -c fateflow/examples/permission/grant.json

选项

参数 短格式 长格式 必选 类型 说明
conf_path -c --conf-path string 配置路径

注: conf_path为参数路径,具体参数如下

参数名 必选 类型 说明
party_id string 站点id
component string 组件名,可用","分割多个组件,"*"为所有组件
dataset object 数据集列表

样例

{
  "party_id": 10000,
  "component": "reader,dataio",
  "dataset": [
    {
      "namespace": "experiment",
      "name": "breast_hetero_guest"
    },
    {
      "namespace": "experiment",
      "name": "breast_hetero_host"
    }
  ]
}

返回

参数名 类型 说明
retcode int 返回码
retmsg string 返回信息

样例

{
    "retcode": 0,
    "retmsg": "success"
}

2.1.3 吊销权限

删除权限

flow privilege delete -c fateflow/examples/permission/delete.json
选项

参数 短格式 长格式 必选 类型 说明
conf_path -c --conf-path string 配置路径

注: conf_path为参数路径,具体参数如下

参数名 必选 类型 说明
party_id string 站点id
component string 组件名,可用","分割多个组件,"*"为所有组件
dataset object 数据集列表, "*"为所有数据集

样例

{
  "party_id": 10000,
  "component": "reader,dataio",
  "dataset": [
    {
      "namespace": "experiment",
      "name": "breast_hetero_guest"
    },
    {
      "namespace": "experiment",
      "name": "breast_hetero_host"
    }
  ]
}

返回

参数名 类型 说明
retcode int 返回码
retmsg string 返回信息

样例

{
    "retcode": 0,
    "retmsg": "success"
}

2.1.4 权限查询

查询权限

flow privilege query -p 10000

选项

参数 短格式 长格式 必选 类型 说明
party_id -p --party-id string 站点id

返回

参数名 类型 说明
retcode int 返回码
retmsg string 返回信息
data object 返回数据

样例

{
    "data": {
        "component": [
            "reader",
            "dataio"
        ],
        "dataset": [
            {
                "name": "breast_hetero_guest",
                "namespace": "experiment"
            },
            {
                "name": "breast_hetero_host",
                "namespace": "experiment"
            }
        ]
    },
    "retcode": 0,
    "retmsg": "success"
}

2.2 第三方接口权限认证

  • 第三方服务需要向flow权限认证接口,具体参考权限认证服务注册
  • 若认证失败,flow会直接返回认证失败给合作方。