跳到主内容

MinIO

MinIO支持使用与OpenID Connect (OIDC)兼容的提供商进行外部身份管理。 本文档介绍了如何配置Casdoor作为身份提供商以支持MinIO。

步骤1:部署Casdoor & MinIO

首先,部署Casdoor。

See Server installation.

成功部署后,请确保:

  • The Casdoor server is running on http://localhost:8000.
  • Open your favorite browser and visit http://localhost:7001 to see the login page of Casdoor.
  • 通过输入admin123来测试登录功能。

Implement a Casdoor-based login in your app with the following steps.

Deploy MinIO: MinIO quickstart. Install the mc client: MinIO mc.

步骤2:配置Casdoor应用程序

  1. 创建一个新的Casdoor应用程序,或使用一个已经存在的。

  2. 添加您的重定向URL。保存应用程序设置

  3. 添加您想要的提供者并提供任何必要的设置。

    Note Client ID and Client secret for the next step. OIDC discovery: http://<CASDOOR_HOSTNAME>/.well-known/openid-configuration.

  4. 这个步骤对于MinIO来说是必要的。 由于MinIO需要在JWT中使用一个声明属性作为其策略,您也应在Casdoor中进行配置。 目前,Casdoor 使用 tag 作为配置 MinIO 策略的一种变通方法。

    MinIO 策略设置

    See MinIO policy-based access control for supported policies.

步骤3:配置MinIO

Start a MinIO server, for example:

导出MINIO_ROOT_USER=minio
导出 MINIO_ROOT_PASSSWORD=minio123
minio server /mnt/export

Use --console-address to set the console address and port.

接下来,使用MinIO客户端mc添加一个服务别名。

mc alias set myminio <您的控制台地址> minio minio123

现在,配置MinIO的OpenID Connect。 对于Casdoor,命令将是:

mc admin config set myminio identity_openid config_url="http://CASDOOR_HOSTNAME/.well-known/openid-configuration" client_id=<client id> client_secret=<client secret> claim_name="tag"

See the MinIO OpenID identity management docs for more parameters.

一旦成功设置,重新启动MinIO实例。

mc 管理服务重启myminio

步骤4:尝试演示!

现在,在浏览器中打开您的MinIO控制台,然后点击使用SSO登录

You are redirected to the Casdoor login page; after sign-in, back to MinIO and logged in. You then see the buckets and objects available to you.

注意事项

If the Casdoor frontend and backend use different ports, the redirect may hit the backend and show 404. Point the redirect URL to the frontend port so the login page loads correctly.