将文件存储在 Google Cloud Storage
本指南介绍如何将 Casdoor 上传的文件(如头像)存储在 Google Cloud Storage 中。
学习目标
- 创建具有存储桶访问权限的服务账号密钥。
- 在 Casdoor 中添加 Google Cloud Storage 作为存储提供商。
所需条件
- 一个包含 Cloud Storage 存储桶的 Google Cloud 项目
- Casdoor 管理控制台的访问员权限
创建服务账号密钥
- 创建服务账号并授予其对存储桶的 IAM 权限。请参阅 Cloud Storage 身份验证。
- 为服务账号创建密钥并将其下载为 JSON 文件。
在 Casdoor 中添加提供商
-
在 Casdoor 管理控制台中,前往 Identity > Providers 并添加一个提供商。
-
将 Category 设置为
Storage,将 Type 设置为Google Cloud Storage。 -
填写以下字段:
字段 GCP 对应项 / 含义 必需 Service Account JSON 服务账号密钥(JSON 内容) Yes Endpoint 接入地址(可选) 不 Bucket Bucket name 是 
-
保存提供商.