From 40ee217a08062cb414b02f9f815d1911f5ad4de5 Mon Sep 17 00:00:00 2001 From: Craig Jellick Date: Tue, 6 Feb 2018 10:56:16 -0700 Subject: [PATCH] Changes for github auth provider --- apis/management.cattle.io/v3/authn_types.go | 18 +++++++++--------- apis/management.cattle.io/v3/schema/schema.go | 9 ++++----- .../v3public/authn_types.go | 2 ++ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/apis/management.cattle.io/v3/authn_types.go b/apis/management.cattle.io/v3/authn_types.go index 8540766c..92397596 100644 --- a/apis/management.cattle.io/v3/authn_types.go +++ b/apis/management.cattle.io/v3/authn_types.go @@ -59,6 +59,7 @@ type Principal struct { Kind string `json:"kind,omitempty"` Me bool `json:"me,omitempty"` MemberOf bool `json:"memberOf,omitempty"` + Provider string `json:"provider,omitempty"` ExtraInfo map[string]string `json:"extraInfo,omitempty"` } @@ -76,32 +77,31 @@ type AuthConfig struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Type string `json:"type"` + Type string `json:"type"` + Enabled bool `json:"enabled,omitempty"` } //GithubConfig structure contains the github config definition type GithubConfig struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - AuthConfig `json:",inline"` + AuthConfig `json:",inline" mapstructure:",squash"` - Hostname string `json:"hostname,omitempty"` - Scheme string `json:"scheme,omitempty"` + Hostname string `json:"hostname,omitempty" norman:"default=github.com"` + TLS bool `json:"tls,omitempty" norman:"notnullable,default=true"` ClientID string `json:"clientId,omitempty"` ClientSecret string `json:"clientSecret,omitempty"` - Enabled bool `json:"enabled,omitempty"` } //LocalConfig structure contains the local config definition type LocalConfig struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` + AuthConfig `json:",inline" mapstructure:",squash"` } -//GithubConfigTestInput structure defines all properties that can be sent by client to configure github -type GithubConfigTestInput struct { - GithubConfig GithubConfig `json:"githubConfig, omitempty"` - Enabled bool `json:"enabled,omitempty"` +type GithubConfigTestOutput struct { + RedirectURL string `json:"redirectUrl"` } //GithubConfigApplyInput structure defines all properties that can be sent by client to configure github diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index 3b9dc878..447fb2aa 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -185,18 +185,17 @@ func authnTypes(schemas *types.Schemas) *types.Schemas { schema.BaseType = "authConfig" schema.ResourceActions = map[string]types.Action{ "configureTest": { - Input: "githubConfigTestInput", - Output: "githubConfig", + Input: "githubConfig", + Output: "githubConfigTestOutput", }, "testAndApply": { - Input: "githubConfigApplyInput", - Output: "githubConfig", + Input: "githubConfigApplyInput", }, } schema.CollectionMethods = []string{} schema.ResourceMethods = []string{http.MethodGet} }). - MustImport(&Version, v3.GithubConfigTestInput{}). + MustImport(&Version, v3.GithubConfigTestOutput{}). MustImport(&Version, v3.GithubConfigApplyInput{}). MustImportAndCustomize(&Version, v3.LocalConfig{}, func(schema *types.Schema) { schema.BaseType = "authConfig" diff --git a/apis/management.cattle.io/v3public/authn_types.go b/apis/management.cattle.io/v3public/authn_types.go index 603d7455..0435fa08 100644 --- a/apis/management.cattle.io/v3public/authn_types.go +++ b/apis/management.cattle.io/v3public/authn_types.go @@ -15,6 +15,8 @@ type GithubProvider struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` AuthProvider `json:",inline"` + + RedirectURL string `json:"redirectUrl"` } type LocalProvider struct {