Browse code

Tweak OAuth config

Jordan Liggitt authored on 2015/04/01 22:38:51
Showing 13 changed files
... ...
@@ -11,7 +11,6 @@ func init() {
11 11
 		&MasterConfig{},
12 12
 		&NodeConfig{},
13 13
 
14
-		&IdentityProviderUsage{},
15 14
 		&IdentityProvider{},
16 15
 		&BasicAuthPasswordIdentityProvider{},
17 16
 		&AllowAllPasswordIdentityProvider{},
... ...
@@ -25,7 +24,6 @@ func init() {
25 25
 	)
26 26
 }
27 27
 
28
-func (*IdentityProviderUsage) IsAnAPIObject()             {}
29 28
 func (*IdentityProvider) IsAnAPIObject()                  {}
30 29
 func (*BasicAuthPasswordIdentityProvider) IsAnAPIObject() {}
31 30
 func (*AllowAllPasswordIdentityProvider) IsAnAPIObject()  {}
... ...
@@ -146,9 +146,9 @@ type AssetConfig struct {
146 146
 	// PublicURL is where you can find the asset server (TODO do we really need this?)
147 147
 	PublicURL string
148 148
 
149
-	// LogoutURI is an optional, absolute URI to redirect web browsers to after logging out of the web console.
149
+	// LogoutURL is an optional, absolute URL to redirect web browsers to after logging out of the web console.
150 150
 	// If not specified, the built-in logout page is shown.
151
-	LogoutURI string
151
+	LogoutURL string
152 152
 
153 153
 	// MasterPublicURL is how the web console can access the OpenShift api server
154 154
 	MasterPublicURL string
... ...
@@ -159,7 +159,7 @@ type AssetConfig struct {
159 159
 }
160 160
 
161 161
 type OAuthConfig struct {
162
-	// MasterURL is used for building valid client redirect URLs for external access
162
+	// MasterURL is used for building valid client redirect URLs for internal access
163 163
 	MasterURL string
164 164
 
165 165
 	// MasterPublicURL is used for building valid client redirect URLs for external access
... ...
@@ -196,20 +196,13 @@ type SessionConfig struct {
196 196
 	SessionName string
197 197
 }
198 198
 
199
-type IdentityProviderUsage struct {
200
-	// ProviderName is used to qualify the identities returned by this provider
201
-	ProviderName string
202
-
199
+type IdentityProvider struct {
200
+	// Name is used to qualify the identities returned by this provider
201
+	Name string
203 202
 	// UseAsChallenger indicates whether to issue WWW-Authenticate challenges for this provider
204 203
 	UseAsChallenger bool
205 204
 	// UseAsLogin indicates whether to use this identity provider for unauthenticated browsers to login against
206 205
 	UseAsLogin bool
207
-}
208
-
209
-type IdentityProvider struct {
210
-	// Usage contains metadata about how to use this provider
211
-	Usage IdentityProviderUsage
212
-
213 206
 	// Provider contains the information about how to set up a specific identity provider
214 207
 	Provider runtime.EmbeddedObject
215 208
 }
... ...
@@ -242,7 +235,7 @@ type RequestHeaderIdentityProvider struct {
242 242
 	// ClientCA is a file with the trusted signer certs.  If empty, no request verification is done, and any direct request to the OAuth server can impersonate any identity from this provider, merely by setting a request header.
243 243
 	ClientCA string
244 244
 	// Headers is the set of headers to check for identity information
245
-	Headers util.StringSet
245
+	Headers []string
246 246
 }
247 247
 
248 248
 type OAuthRedirectingIdentityProvider struct {
... ...
@@ -2,7 +2,6 @@ package v1
2 2
 
3 3
 import (
4 4
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/conversion"
5
-	"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
6 5
 	newer "github.com/openshift/origin/pkg/cmd/server/api"
7 6
 )
8 7
 
... ...
@@ -22,6 +21,20 @@ func init() {
22 22
 			out.KeyFile = in.ServerCert.KeyFile
23 23
 			return nil
24 24
 		},
25
+		func(in *RemoteConnectionInfo, out *newer.RemoteConnectionInfo, s conversion.Scope) error {
26
+			out.URL = in.URL
27
+			out.CA = in.CA
28
+			out.ClientCert.CertFile = in.CertFile
29
+			out.ClientCert.KeyFile = in.KeyFile
30
+			return nil
31
+		},
32
+		func(in *newer.RemoteConnectionInfo, out *RemoteConnectionInfo, s conversion.Scope) error {
33
+			out.URL = in.URL
34
+			out.CA = in.CA
35
+			out.CertFile = in.ClientCert.CertFile
36
+			out.KeyFile = in.ClientCert.KeyFile
37
+			return nil
38
+		},
25 39
 		func(in *EtcdConnectionInfo, out *newer.EtcdConnectionInfo, s conversion.Scope) error {
26 40
 			out.URLs = in.URLs
27 41
 			out.CA = in.CA
... ...
@@ -50,20 +63,6 @@ func init() {
50 50
 			out.KeyFile = in.ClientCert.KeyFile
51 51
 			return nil
52 52
 		},
53
-		func(in *RequestHeaderIdentityProvider, out *newer.RequestHeaderIdentityProvider, s conversion.Scope) error {
54
-			if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
55
-				return err
56
-			}
57
-			out.Headers = util.NewStringSet(in.HeadersSlice...)
58
-			return nil
59
-		},
60
-		func(in *newer.RequestHeaderIdentityProvider, out *RequestHeaderIdentityProvider, s conversion.Scope) error {
61
-			if err := s.DefaultConvert(in, out, conversion.IgnoreMissingFields); err != nil {
62
-				return err
63
-			}
64
-			out.HeadersSlice = in.Headers.List()
65
-			return nil
66
-		},
67 53
 	)
68 54
 	if err != nil {
69 55
 		// If one of the conversion functions is malformed, detect it immediately.
... ...
@@ -12,7 +12,6 @@ func init() {
12 12
 		&MasterConfig{},
13 13
 		&NodeConfig{},
14 14
 
15
-		&IdentityProviderUsage{},
16 15
 		&IdentityProvider{},
17 16
 		&BasicAuthPasswordIdentityProvider{},
18 17
 		&AllowAllPasswordIdentityProvider{},
... ...
@@ -26,7 +25,6 @@ func init() {
26 26
 	)
27 27
 }
28 28
 
29
-func (*IdentityProviderUsage) IsAnAPIObject()             {}
30 29
 func (*IdentityProvider) IsAnAPIObject()                  {}
31 30
 func (*BasicAuthPasswordIdentityProvider) IsAnAPIObject() {}
32 31
 func (*AllowAllPasswordIdentityProvider) IsAnAPIObject()  {}
... ...
@@ -145,9 +145,9 @@ type AssetConfig struct {
145 145
 	// PublicURL is where you can find the asset server (TODO do we really need this?)
146 146
 	PublicURL string `json:"publicURL"`
147 147
 
148
-	// LogoutURI is an optional, absolute URI to redirect web browsers to after logging out of the web console.
148
+	// LogoutURL is an optional, absolute URL to redirect web browsers to after logging out of the web console.
149 149
 	// If not specified, the built-in logout page is shown.
150
-	LogoutURI string `json:"logoutURI"`
150
+	LogoutURL string `json:"logoutURL"`
151 151
 
152 152
 	// MasterPublicURL is how the web console can access the OpenShift v1beta3 server
153 153
 	MasterPublicURL string `json:"masterPublicURL"`
... ...
@@ -192,16 +192,14 @@ type SessionConfig struct {
192 192
 	SessionName string `json:"sessionName"`
193 193
 }
194 194
 
195
-type IdentityProviderUsage struct {
196
-	ProviderName string `json:"providerName"`
197
-
198
-	UseAsChallenger bool `json:"challenge"`
199
-	UseAsLogin      bool `json:"login"`
200
-}
201
-
202 195
 type IdentityProvider struct {
203
-	Usage IdentityProviderUsage `json:"usage"`
204
-
196
+	// Name is used to qualify the identities returned by this provider
197
+	Name string `json:"name"`
198
+	// UseAsChallenger indicates whether to issue WWW-Authenticate challenges for this provider
199
+	UseAsChallenger bool `json:"challenge"`
200
+	// UseAsLogin indicates whether to use this identity provider for unauthenticated browsers to login against
201
+	UseAsLogin bool `json:"login"`
202
+	// Provider contains the information about how to set up a specific identity provider
205 203
 	Provider runtime.RawExtension `json:"provider"`
206 204
 }
207 205
 
... ...
@@ -228,8 +226,8 @@ type HTPasswdPasswordIdentityProvider struct {
228 228
 type RequestHeaderIdentityProvider struct {
229 229
 	v1beta3.TypeMeta `json:",inline"`
230 230
 
231
-	ClientCA     string   `json:"clientCA"`
232
-	HeadersSlice []string `json:"headers"`
231
+	ClientCA string   `json:"clientCA"`
232
+	Headers  []string `json:"headers"`
233 233
 }
234 234
 
235 235
 type OAuthRedirectingIdentityProvider struct {
... ...
@@ -83,6 +83,13 @@ func ValidateAssetConfig(config *api.AssetConfig) fielderrors.ValidationErrorLis
83 83
 
84 84
 	allErrs = append(allErrs, ValidateServingInfo(config.ServingInfo).Prefix("servingInfo")...)
85 85
 
86
+	if len(config.LogoutURL) > 0 {
87
+		_, urlErrs := ValidateURL(config.LogoutURL, "logoutURL")
88
+		if len(urlErrs) > 0 {
89
+			allErrs = append(allErrs, urlErrs...)
90
+		}
91
+	}
92
+
86 93
 	urlObj, urlErrs := ValidateURL(config.PublicURL, "publicURL")
87 94
 	if len(urlErrs) > 0 {
88 95
 		allErrs = append(allErrs, urlErrs...)
... ...
@@ -3,6 +3,7 @@ package validation
3 3
 import (
4 4
 	"fmt"
5 5
 
6
+	"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
6 7
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/util/fielderrors"
7 8
 	"github.com/openshift/origin/pkg/cmd/server/api"
8 9
 )
... ...
@@ -28,10 +29,11 @@ func ValidateOAuthConfig(config *api.OAuthConfig) fielderrors.ValidationErrorLis
28 28
 
29 29
 	allErrs = append(allErrs, ValidateGrantConfig(config.GrantConfig).Prefix("grantConfig")...)
30 30
 
31
-	redirectingIdentityProviders := []int{}
31
+	providerNames := util.NewStringSet()
32
+	redirectingIdentityProviders := []string{}
32 33
 	for i, identityProvider := range config.IdentityProviders {
33
-		if identityProvider.Usage.UseAsLogin {
34
-			redirectingIdentityProviders = append(redirectingIdentityProviders, i)
34
+		if identityProvider.UseAsLogin {
35
+			redirectingIdentityProviders = append(redirectingIdentityProviders, identityProvider.Name)
35 36
 
36 37
 			if api.IsPasswordAuthenticator(identityProvider) {
37 38
 				if config.SessionConfig == nil {
... ...
@@ -41,6 +43,13 @@ func ValidateOAuthConfig(config *api.OAuthConfig) fielderrors.ValidationErrorLis
41 41
 		}
42 42
 
43 43
 		allErrs = append(allErrs, ValidateIdentityProvider(identityProvider).Prefix(fmt.Sprintf("identityProvider[%d]", i))...)
44
+
45
+		if len(identityProvider.Name) > 0 {
46
+			if providerNames.Has(identityProvider.Name) {
47
+				allErrs = append(allErrs, fielderrors.NewFieldInvalid(fmt.Sprintf("identityProvider[%d].name", i), identityProvider.Name, "must have a unique name"))
48
+			}
49
+			providerNames.Insert(identityProvider.Name)
50
+		}
44 51
 	}
45 52
 
46 53
 	if len(redirectingIdentityProviders) > 1 {
... ...
@@ -53,8 +62,8 @@ func ValidateOAuthConfig(config *api.OAuthConfig) fielderrors.ValidationErrorLis
53 53
 func ValidateIdentityProvider(identityProvider api.IdentityProvider) fielderrors.ValidationErrorList {
54 54
 	allErrs := fielderrors.ValidationErrorList{}
55 55
 
56
-	if len(identityProvider.Usage.ProviderName) == 0 {
57
-		allErrs = append(allErrs, fielderrors.NewFieldRequired("usage.providerName"))
56
+	if len(identityProvider.Name) == 0 {
57
+		allErrs = append(allErrs, fielderrors.NewFieldRequired("name"))
58 58
 	}
59 59
 
60 60
 	if !api.IsIdentityProviderType(identityProvider.Provider) {
... ...
@@ -68,11 +77,11 @@ func ValidateIdentityProvider(identityProvider api.IdentityProvider) fielderrors
68 68
 			if len(provider.Headers) == 0 {
69 69
 				allErrs = append(allErrs, fielderrors.NewFieldRequired("provider.headers"))
70 70
 			}
71
-			if identityProvider.Usage.UseAsChallenger {
72
-				allErrs = append(allErrs, fielderrors.NewFieldInvalid("provider.useAsChallenger", identityProvider.Usage.UseAsChallenger, "request header providers cannot be used for challenges"))
71
+			if identityProvider.UseAsChallenger {
72
+				allErrs = append(allErrs, fielderrors.NewFieldInvalid("challenge", identityProvider.UseAsChallenger, "request header providers cannot be used for challenges"))
73 73
 			}
74
-			if identityProvider.Usage.UseAsLogin {
75
-				allErrs = append(allErrs, fielderrors.NewFieldInvalid("provider.useAsLogin", identityProvider.Usage.UseAsChallenger, "request header providers cannot be used for browser login"))
74
+			if identityProvider.UseAsLogin {
75
+				allErrs = append(allErrs, fielderrors.NewFieldInvalid("login", identityProvider.UseAsChallenger, "request header providers cannot be used for browser login"))
76 76
 			}
77 77
 
78 78
 		case (*api.BasicAuthPasswordIdentityProvider):
... ...
@@ -91,8 +100,8 @@ func ValidateIdentityProvider(identityProvider api.IdentityProvider) fielderrors
91 91
 			if !api.IsOAuthProviderType(provider.Provider) {
92 92
 				allErrs = append(allErrs, fielderrors.NewFieldInvalid("provider.provider", provider.Provider, fmt.Sprintf("%v is invalid in this context", identityProvider.Provider)))
93 93
 			}
94
-			if identityProvider.Usage.UseAsChallenger {
95
-				allErrs = append(allErrs, fielderrors.NewFieldInvalid("provider.useAsChallenger", identityProvider.Usage.UseAsChallenger, "oauth providers cannot be used for challenges"))
94
+			if identityProvider.UseAsChallenger {
95
+				allErrs = append(allErrs, fielderrors.NewFieldInvalid("challenge", identityProvider.UseAsChallenger, "oauth providers cannot be used for challenges"))
96 96
 			}
97 97
 		}
98 98
 
... ...
@@ -79,6 +79,9 @@ func ValidateRemoteConnectionInfo(remoteConnectionInfo api.RemoteConnectionInfo)
79 79
 
80 80
 	if len(remoteConnectionInfo.URL) == 0 {
81 81
 		allErrs = append(allErrs, fielderrors.NewFieldRequired("url"))
82
+	} else {
83
+		_, urlErrs := ValidateURL(remoteConnectionInfo.URL, "url")
84
+		allErrs = append(allErrs, urlErrs...)
82 85
 	}
83 86
 
84 87
 	if len(remoteConnectionInfo.CA) > 0 {
... ...
@@ -114,7 +114,7 @@ func (c *AssetConfig) buildHandler() (http.Handler, error) {
114 114
 		OAuthAuthorizeURI: OpenShiftOAuthAuthorizeURL(masterURL.String()),
115 115
 		OAuthRedirectBase: c.Options.PublicURL,
116 116
 		OAuthClientID:     OpenShiftWebConsoleClientID,
117
-		LogoutURI:         c.Options.LogoutURI,
117
+		LogoutURI:         c.Options.LogoutURL,
118 118
 	}
119 119
 
120 120
 	handler := http.FileServer(
... ...
@@ -307,12 +307,12 @@ func (c *AuthConfig) getAuthenticationHandler(mux cmdutil.Mux, errorHandler hand
307 307
 				return nil, err
308 308
 			}
309 309
 
310
-			if identityProvider.Usage.UseAsLogin {
310
+			if identityProvider.UseAsLogin {
311 311
 				redirectors["login"] = &redirector{RedirectURL: OpenShiftLoginPrefix, ThenParam: "then"}
312 312
 				login := login.NewLogin(getCSRF(), &callbackPasswordAuthenticator{passwordAuth, successHandler}, login.DefaultLoginFormRenderer)
313 313
 				login.Install(mux, OpenShiftLoginPrefix)
314 314
 			}
315
-			if identityProvider.Usage.UseAsChallenger {
315
+			if identityProvider.UseAsChallenger {
316 316
 				challengers["login"] = passwordchallenger.NewBasicAuthChallenger("openshift")
317 317
 			}
318 318
 
... ...
@@ -324,10 +324,10 @@ func (c *AuthConfig) getAuthenticationHandler(mux cmdutil.Mux, errorHandler hand
324 324
 				switch provider.Provider.Object.(type) {
325 325
 				case (*configapi.GoogleOAuthProvider):
326 326
 					callbackPath = path.Join(OpenShiftOAuthCallbackPrefix, "google")
327
-					oauthProvider = google.NewProvider(identityProvider.Usage.ProviderName, provider.ClientID, provider.ClientSecret)
327
+					oauthProvider = google.NewProvider(identityProvider.Name, provider.ClientID, provider.ClientSecret)
328 328
 				case (*configapi.GitHubOAuthProvider):
329 329
 					callbackPath = path.Join(OpenShiftOAuthCallbackPrefix, "github")
330
-					oauthProvider = github.NewProvider(identityProvider.Usage.ProviderName, provider.ClientID, provider.ClientSecret)
330
+					oauthProvider = github.NewProvider(identityProvider.Name, provider.ClientID, provider.ClientSecret)
331 331
 				default:
332 332
 					return nil, fmt.Errorf("unexpected oauth provider %#v", provider)
333 333
 				}
... ...
@@ -339,10 +339,10 @@ func (c *AuthConfig) getAuthenticationHandler(mux cmdutil.Mux, errorHandler hand
339 339
 				}
340 340
 
341 341
 				mux.Handle(callbackPath, oauthHandler)
342
-				if identityProvider.Usage.UseAsLogin {
343
-					redirectors[identityProvider.Usage.ProviderName] = oauthHandler
342
+				if identityProvider.UseAsLogin {
343
+					redirectors[identityProvider.Name] = oauthHandler
344 344
 				}
345
-				if identityProvider.Usage.UseAsChallenger {
345
+				if identityProvider.UseAsChallenger {
346 346
 					return nil, errors.New("oauth identity providers cannot issue challenges")
347 347
 				}
348 348
 			}
... ...
@@ -358,7 +358,7 @@ func (c *AuthConfig) getPasswordAuthenticator(identityProvider configapi.Identit
358 358
 
359 359
 	switch provider := identityProvider.Provider.Object.(type) {
360 360
 	case (*configapi.AllowAllPasswordIdentityProvider):
361
-		return allowanypassword.New(identityProvider.Usage.ProviderName, identityMapper), nil
361
+		return allowanypassword.New(identityProvider.Name, identityMapper), nil
362 362
 
363 363
 	case (*configapi.DenyAllPasswordIdentityProvider):
364 364
 		return denypassword.New(), nil
... ...
@@ -368,7 +368,7 @@ func (c *AuthConfig) getPasswordAuthenticator(identityProvider configapi.Identit
368 368
 		if len(htpasswdFile) == 0 {
369 369
 			return nil, fmt.Errorf("HTPasswdFile is required to support htpasswd auth")
370 370
 		}
371
-		if htpasswordAuth, err := htpasswd.New(identityProvider.Usage.ProviderName, htpasswdFile, identityMapper); err != nil {
371
+		if htpasswordAuth, err := htpasswd.New(identityProvider.Name, htpasswdFile, identityMapper); err != nil {
372 372
 			return nil, fmt.Errorf("Error loading htpasswd file %s: %v", htpasswdFile, err)
373 373
 		} else {
374 374
 			return htpasswordAuth, nil
... ...
@@ -379,7 +379,7 @@ func (c *AuthConfig) getPasswordAuthenticator(identityProvider configapi.Identit
379 379
 		if len(basicAuthURL) == 0 {
380 380
 			return nil, fmt.Errorf("BasicAuthURL is required to support basic password auth")
381 381
 		}
382
-		return basicauthpassword.New(identityProvider.Usage.ProviderName, basicAuthURL, identityMapper), nil
382
+		return basicauthpassword.New(identityProvider.Name, basicAuthURL, identityMapper), nil
383 383
 
384 384
 	default:
385 385
 		return nil, fmt.Errorf("No password auth found that matches %v.  The oauth server cannot start!", identityProvider)
... ...
@@ -396,7 +396,7 @@ func (c *AuthConfig) getAuthenticationSuccessHandler() handlers.AuthenticationSu
396 396
 
397 397
 	addedRedirectSuccessHandler := false
398 398
 	for _, identityProvider := range c.Options.IdentityProviders {
399
-		if !identityProvider.Usage.UseAsLogin {
399
+		if !identityProvider.UseAsLogin {
400 400
 			continue
401 401
 		}
402 402
 
... ...
@@ -437,9 +437,9 @@ func (c *AuthConfig) getAuthenticationRequestHandler() (authenticator.Request, e
437 437
 				var authRequestHandler authenticator.Request
438 438
 
439 439
 				authRequestConfig := &headerrequest.Config{
440
-					UserNameHeaders: provider.Headers.List(),
440
+					UserNameHeaders: provider.Headers,
441 441
 				}
442
-				authRequestHandler = headerrequest.NewAuthenticator(identityProvider.Usage.ProviderName, authRequestConfig, identityMapper)
442
+				authRequestHandler = headerrequest.NewAuthenticator(identityProvider.Name, authRequestConfig, identityMapper)
443 443
 
444 444
 				// Wrap with an x509 verifier
445 445
 				if len(provider.ClientCA) > 0 {
... ...
@@ -164,7 +164,7 @@ func (args MasterArgs) BuildSerializeableMasterConfig() (*configapi.MasterConfig
164 164
 				BindAddress: args.GetAssetBindAddress(),
165 165
 			},
166 166
 
167
-			LogoutURI:           "",
167
+			LogoutURL:           "",
168 168
 			MasterPublicURL:     masterPublicAddr.String(),
169 169
 			PublicURL:           assetPublicAddr.String(),
170 170
 			KubernetesPublicURL: kubePublicAddr.String(),
... ...
@@ -287,11 +287,9 @@ func (args MasterArgs) BuildSerializeableOAuthConfig() (*configapi.OAuthConfig,
287 287
 
288 288
 	config.IdentityProviders = append(config.IdentityProviders,
289 289
 		configapi.IdentityProvider{
290
-			Usage: configapi.IdentityProviderUsage{
291
-				ProviderName:    "anypassword",
292
-				UseAsChallenger: true,
293
-				UseAsLogin:      true,
294
-			},
290
+			Name:            "anypassword",
291
+			UseAsChallenger: true,
292
+			UseAsLogin:      true,
295 293
 			Provider: runtime.EmbeddedObject{
296 294
 				&configapi.AllowAllPasswordIdentityProvider{},
297 295
 			},
... ...
@@ -29,11 +29,9 @@ func TestHTPasswd(t *testing.T) {
29 29
 	}
30 30
 
31 31
 	masterOptions.OAuthConfig.IdentityProviders[0] = configapi.IdentityProvider{
32
-		Usage: configapi.IdentityProviderUsage{
33
-			ProviderName:    "htpasswd",
34
-			UseAsChallenger: true,
35
-			UseAsLogin:      true,
36
-		},
32
+		Name:            "htpasswd",
33
+		UseAsChallenger: true,
34
+		UseAsLogin:      true,
37 35
 		Provider: runtime.EmbeddedObject{
38 36
 			&configapi.HTPasswdPasswordIdentityProvider{
39 37
 				File: htpasswdFile.Name(),
... ...
@@ -11,7 +11,6 @@ import (
11 11
 
12 12
 	kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
13 13
 	"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
14
-	"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
15 14
 
16 15
 	"github.com/openshift/origin/pkg/client"
17 16
 	configapi "github.com/openshift/origin/pkg/cmd/server/api"
... ...
@@ -106,15 +105,13 @@ func TestOAuthRequestHeader(t *testing.T) {
106 106
 	}
107 107
 
108 108
 	masterOptions.OAuthConfig.IdentityProviders[0] = configapi.IdentityProvider{
109
-		Usage: configapi.IdentityProviderUsage{
110
-			ProviderName:    "requestheader",
111
-			UseAsChallenger: false,
112
-			UseAsLogin:      false,
113
-		},
109
+		Name:            "requestheader",
110
+		UseAsChallenger: false,
111
+		UseAsLogin:      false,
114 112
 		Provider: runtime.EmbeddedObject{
115 113
 			&configapi.RequestHeaderIdentityProvider{
116 114
 				ClientCA: caFile.Name(),
117
-				Headers:  util.NewStringSet("My-Remote-User", "SSO-User"),
115
+				Headers:  []string{"My-Remote-User", "SSO-User"},
118 116
 			},
119 117
 		},
120 118
 	}