diff --git a/apis/management.cattle.io/v3/authn_types.go b/apis/management.cattle.io/v3/authn_types.go index 5cb0badc..ec0428cf 100644 --- a/apis/management.cattle.io/v3/authn_types.go +++ b/apis/management.cattle.io/v3/authn_types.go @@ -162,6 +162,28 @@ type GithubConfigApplyInput struct { Enabled bool `json:"enabled,omitempty"` } +type GoogleOauthConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + AuthConfig `json:",inline" mapstructure:",squash"` + + OauthCredential string `json:"oauthCredential,omitempty" norman:"required"` + ServiceAccountCredential string `json:"serviceAccountCredential,omitempty"` + AdminEmail string `json:"adminEmail,omitempty"` + Hostname string `json:"hostname,omitempty" norman:"required"` + UserInfoEndpoint string `json:"userInfoEndpoint" norman:"default=https://openidconnect.googleapis.com/v1/userinfo,required,notnullable"` +} + +type GoogleOauthConfigTestOutput struct { + RedirectURL string `json:"redirectUrl"` +} + +type GoogleOauthConfigApplyInput struct { + GoogleOauthConfig GoogleOauthConfig `json:"googleOauthConfig,omitempty"` + Code string `json:"code,omitempty"` + Enabled bool `json:"enabled,omitempty"` +} + type AzureADConfig struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index 09b6a610..c260a3fb 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -506,7 +506,25 @@ func authnTypes(schemas *types.Schemas) *types.Schemas { MustImportAndCustomize(&Version, v3.KeyCloakConfig{}, configSchema). MustImportAndCustomize(&Version, v3.OKTAConfig{}, configSchema). MustImport(&Version, v3.SamlConfigTestInput{}). - MustImport(&Version, v3.SamlConfigTestOutput{}) + MustImport(&Version, v3.SamlConfigTestOutput{}). + //GoogleOAuth Config + MustImportAndCustomize(&Version, v3.GoogleOauthConfig{}, func(schema *types.Schema) { + schema.BaseType = "authConfig" + schema.ResourceActions = map[string]types.Action{ + "disable": {}, + "configureTest": { + Input: "googleOauthConfig", + Output: "googleOauthConfigTestOutput", + }, + "testAndApply": { + Input: "googleOauthConfigApplyInput", + }, + } + schema.CollectionMethods = []string{} + schema.ResourceMethods = []string{http.MethodGet, http.MethodPut} + }). + MustImport(&Version, v3.GoogleOauthConfigApplyInput{}). + MustImport(&Version, v3.GoogleOauthConfigTestOutput{}) } func configSchema(schema *types.Schema) { diff --git a/apis/management.cattle.io/v3public/authn_types.go b/apis/management.cattle.io/v3public/authn_types.go index d2b59529..16584886 100644 --- a/apis/management.cattle.io/v3public/authn_types.go +++ b/apis/management.cattle.io/v3public/authn_types.go @@ -42,6 +42,19 @@ type GithubLogin struct { Code string `json:"code" norman:"type=string,required"` } +type GoogleOAuthProvider struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + AuthProvider `json:",inline"` + + RedirectURL string `json:"redirectUrl"` +} + +type GoogleOauthLogin struct { + GenericLogin `json:",inline"` + Code string `json:"code" norman:"type=string,required"` +} + type ActiveDirectoryProvider struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/management.cattle.io/v3public/schema/public_schema.go b/apis/management.cattle.io/v3public/schema/public_schema.go index 01e73e4c..2236637a 100644 --- a/apis/management.cattle.io/v3public/schema/public_schema.go +++ b/apis/management.cattle.io/v3public/schema/public_schema.go @@ -56,6 +56,19 @@ func authProvidersTypes(schemas *types.Schemas) *types.Schemas { schema.ResourceMethods = []string{http.MethodGet} }). MustImport(&PublicVersion, v3public.GithubLogin{}). + // Google OAuth provider + MustImportAndCustomize(&PublicVersion, v3public.GoogleOAuthProvider{}, func(schema *types.Schema) { + schema.BaseType = "authProvider" + schema.ResourceActions = map[string]types.Action{ + "login": { + Input: "googleOauthLogin", + Output: "token", + }, + } + schema.CollectionMethods = []string{} + schema.ResourceMethods = []string{http.MethodGet} + }). + MustImport(&PublicVersion, v3public.GoogleOauthLogin{}). // Active Directory provider MustImportAndCustomize(&PublicVersion, v3public.ActiveDirectoryProvider{}, func(schema *types.Schema) { schema.BaseType = "authProvider"