minio使用google openAPI登陆

2022-10-07  本文已影响0人  Goun

1.简介

minio官方提供二种第三方登录接入方法:

2.在google后台生成相关认证信息

{
    "web":{
        "client_id":"123456",
        "project_id":"test",
        "auth_uri":"https://accounts.google.com/o/oauth2/auth",
        "token_uri":"https://oauth2.googleapis.com/token",
         "client_secret":"abcd123",
        "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
        "redirect_uris":[
            "https://minio/oauth_callback"
        ],
        "javascript_origins":[
            "https://minio"
        ]
    }
}

3.安装minio

这里使用helm安装到k8s中,安装方法就不列出。

获取helm chart

$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm fetch bitnami/minio --version 11.3.2

修改values.yaml,配置相关参数信息

extraEnvVars:
  - name: MINIO_IDENTITY_OPENID_CLIENT_ID
    value: "123456"
  - name: MINIO_IDENTITY_OPENID_CLIENT_SECRET
    value: "abcd123"
  - name: MINIO_IDENTITY_OPENID_REDIRECT_URI
    value: "https://minio/oauth_callback"
  - name: MINIO_IDENTITY_OPENID_SCOPES
    value: "openid,email,profile"
  - name: MINIO_IDENTITY_OPENID_CONFIG_URL
    value: "https://accounts.google.com/.well-known/openid-configuration"
  - name: MINIO_IDENTITY_OPENID_CLAIM_NAME
    value: email

说明:

4.创建默认策略

策略文件:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::test/**"
            ]
    ]
}        

创建策略

$ mc admin policy add test abc@test.com minio-acces-policy.json

5.打开Web界面,跳转到google auth,使用abc@test.com邮箱登陆,就会自动绑定上述策略。

6.总结

不足之处:

上一篇下一篇

猜你喜欢

热点阅读