mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
feature: support Google Oauth2.0
This commit is contained in:
@@ -95,6 +95,7 @@ const (
|
||||
IdpTemplateDex = "dex_oidc"
|
||||
IdpTemplateGithub = "github_oidc"
|
||||
IdpTemplateAzureOAuth2 = "azure_oidc"
|
||||
IdpTemplateGoogle = "google_oidc"
|
||||
|
||||
IdpTemplateAlipay = "alipay_oauth2"
|
||||
IdpTemplateWechat = "wechat_oauth2"
|
||||
|
||||
@@ -46,6 +46,13 @@ type SOIDCGithubConfigOptions struct {
|
||||
SIdpAttributeOptions
|
||||
}
|
||||
|
||||
type SOIDCGoogleConfigOptions struct {
|
||||
ClientId string `json:"client_id"`
|
||||
ClientSecret string `json:"client_secret"`
|
||||
|
||||
SIdpAttributeOptions
|
||||
}
|
||||
|
||||
const (
|
||||
AZURE_CLOUD_ENV_CHINA = "china"
|
||||
AZURE_CLOUD_ENV_GLOBAL = "global"
|
||||
|
||||
@@ -73,6 +73,8 @@ func (self *SOIDCDriver) prepareConfig() error {
|
||||
conf = DexOIDCTemplate
|
||||
case api.IdpTemplateGithub:
|
||||
conf = GithubOIDCTemplate
|
||||
case api.IdpTemplateGoogle:
|
||||
conf = GoogleOIDCTemplate
|
||||
case api.IdpTemplateAzureOAuth2:
|
||||
conf = AzureADTemplate
|
||||
tenantId, _ := confJson.GetString("tenant_id")
|
||||
|
||||
@@ -53,6 +53,26 @@ var (
|
||||
},
|
||||
}
|
||||
|
||||
// {
|
||||
// "sub": "112176790568447731603",
|
||||
// "name": "Jian Qiu",
|
||||
// "given_name": "Jian",
|
||||
// "family_name": "Qiu",
|
||||
// "picture": "https://lh3.googleusercontent.com/a/AATXAJyj32UmKhmwI38ljm8xI53LX4Lw3w5wYxKsj4JS\u003ds96-c",
|
||||
// "email": "swordqiu@gmail.com",
|
||||
// "email_verified": true,
|
||||
// "locale": "zh-CN"
|
||||
// }
|
||||
GoogleOIDCTemplate = api.SOIDCIdpConfigOptions{
|
||||
Endpoint: "https://accounts.google.com",
|
||||
SIdpAttributeOptions: api.SIdpAttributeOptions{
|
||||
UserIdAttribute: "sub",
|
||||
UserNameAttribute: "email",
|
||||
UserEmailAttribute: "email",
|
||||
UserDisplaynameAttribtue: "name",
|
||||
},
|
||||
}
|
||||
|
||||
AzureADTemplate = api.SOIDCIdpConfigOptions{
|
||||
Scopes: []string{
|
||||
"openid",
|
||||
|
||||
Reference in New Issue
Block a user