跳到主内容

将文件存储在 Google Cloud Storage

本指南介绍如何将 Casdoor 上传的文件(如头像)存储在 Google Cloud Storage 中。


学习目标​

  • 创建具有存储桶访问权限的服务账号密钥。
  • 在 Casdoor 中添加 Google Cloud Storage 作为存储提供商。

所需条件​

  • 一个包含 Cloud Storage 存储桶的 Google Cloud 项目
  • Casdoor 管理控制台的访问员权限

创建服务账号密钥​

  1. 创建服务账号并授予其对存储桶的 IAM 权限。请参阅 Cloud Storage 身份验证。
  2. 为服务账号创建密钥并将其下载为 JSON 文件。

在 Casdoor 中添加提供商​

  1. 在 Casdoor 管理控制台中,前往 Identity > Providers 并添加一个提供商。

  2. 将 Category 设置为 Storage,将 Type 设置为 Google Cloud Storage。

  3. 填写以下字段:

    字段GCP 对应项 / 含义必需
    Service Account JSON服务账号密钥(JSON 内容)Yes
    Endpoint接入地址(可选)不
    BucketBucket name是

    Google Cloud Storage provider in Casdoor

  4. 保存提供商.

另请参阅​