github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/boom/application/applications/monitoring/auth/google.go (about) 1 package auth 2 3 import ( 4 "strings" 5 6 "github.com/caos/orbos/pkg/secret/read" 7 8 google "github.com/caos/orbos/internal/operator/boom/api/latest/monitoring/auth/Google" 9 ) 10 11 func GetGoogleAuthConfig(spec *google.Auth) (map[string]string, error) { 12 clientID, err := read.GetSecretValueOnlyIncluster(spec.ClientID, spec.ExistingClientIDSecret) 13 if err != nil { 14 return nil, err 15 } 16 17 clientSecret, err := read.GetSecretValueOnlyIncluster(spec.ClientSecret, spec.ExistingClientSecretSecret) 18 if err != nil { 19 return nil, err 20 } 21 22 if clientID == "" || clientSecret == "" { 23 return nil, nil 24 } 25 26 domains := strings.Join(spec.AllowedDomains, " ") 27 28 return map[string]string{ 29 "enabled": "true", 30 "client_id": string(clientID), 31 "client_secret": string(clientSecret), 32 "scopes": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email", 33 "auth_url": "https://accounts.google.com/o/oauth2/auth", 34 "token_url": "https://accounts.google.com/o/oauth2/token", 35 "allowed_domains": domains, 36 "allow_sign_up": "true", 37 }, nil 38 }