1
0
mirror of https://github.com/rancher/types.git synced 2025-08-18 04:16:59 +00:00

Add google oauth schema

This commit is contained in:
rajashree 2019-05-22 16:42:41 -07:00 committed by Alena Prokharchyk
parent 264466fb30
commit 9125ab265f
4 changed files with 67 additions and 1 deletions

View File

@ -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"`

View File

@ -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) {

View File

@ -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"`

View File

@ -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"