@@ -25,6 +25,7 @@ import (
25
25
configapi "github.com/openshift/origin/pkg/cmd/server/apis/config"
26
26
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
27
27
"github.com/openshift/origin/pkg/cmd/server/cm"
28
+ oauthutil "github.com/openshift/origin/pkg/oauth/util"
28
29
"github.com/openshift/origin/pkg/security/mcs"
29
30
"github.com/openshift/origin/pkg/security/uid"
30
31
"github.com/openshift/origin/pkg/util/labelselector"
@@ -144,6 +145,21 @@ func ValidateMasterConfig(config *configapi.MasterConfig, fldPath *field.Path) V
144
145
if config .OAuthConfig != nil {
145
146
validationResults .Append (ValidateOAuthConfig (config .OAuthConfig , fldPath .Child ("oauthConfig" )))
146
147
}
148
+ if config .ExternalOAuthConfig != nil {
149
+ if config .OAuthConfig != nil {
150
+ validationResults .AddErrors (field .Invalid (fldPath .Child ("externalOAuthConfig" ), config .ExternalOAuthConfig , "Cannot specify External OAuth Config when the internal Oauth Server is configured" ))
151
+ }
152
+ _ , err := oauthutil .LoadOAuthMetadataFile (config .ExternalOAuthConfig .MetadataFile )
153
+ if err != nil {
154
+ validationResults .AddErrors (field .Invalid (fldPath .Child ("externalOAuthConfig" , "metadataFile" ), config .ExternalOAuthConfig .MetadataFile , fmt .Sprintf ("Metadata validation failed: %v" , err )))
155
+ }
156
+ if len (config .ExternalOAuthConfig .MasterPublicURL ) == 0 {
157
+ validationResults .AddErrors (field .Required (fldPath .Child ("externalOAuthConfig" , "masterPublicURL" ), "" ))
158
+ }
159
+ if len (config .ExternalOAuthConfig .AssetPublicURL ) == 0 {
160
+ validationResults .AddErrors (field .Required (fldPath .Child ("externalOAuthConfig" , "assetPublicURL" ), "" ))
161
+ }
162
+ }
147
163
148
164
validationResults .Append (ValidateServiceAccountConfig (config .ServiceAccountConfig , builtInKubernetes , fldPath .Child ("serviceAccountConfig" )))
149
165
0 commit comments