@@ -19,15 +19,16 @@ import (
19
19
_ "github.com/openshift/oauth-apiserver/pkg/api/install"
20
20
)
21
21
22
- var specInfo = spec.Info {
23
- InfoProps : spec.InfoProps {
24
- Title : "OpenShift OAuth-related APIs" ,
25
- Version : version .Get ().String (),
26
- License : & spec.License {
27
- Name : "Apache 2.0 (ASL2.0)" ,
28
- URL : "http://www.apache.org/licenses/LICENSE-2.0" ,
29
- },
30
- Description : heredoc .Doc (`
22
+ var (
23
+ specInfo = spec.Info {
24
+ InfoProps : spec.InfoProps {
25
+ Title : "OpenShift OAuth-related APIs" ,
26
+ Version : version .Get ().String (),
27
+ License : & spec.License {
28
+ Name : "Apache 2.0 (ASL2.0)" ,
29
+ URL : "http://www.apache.org/licenses/LICENSE-2.0" ,
30
+ },
31
+ Description : heredoc .Doc (`
31
32
OpenShift OAuth APIs provide access and authorization tokens,
32
33
users, groups and similar objects required for OpenShift integrated
33
34
OAuth authentication to work on top of Kubernetes. The API allows
@@ -91,42 +92,38 @@ var specInfo = spec.Info{
91
92
See the OpenShift documentation at https://docs.openshift.org for more
92
93
information.
93
94
` ),
94
- },
95
- }
96
-
97
- func DefaultOpenAPIConfig () * openapicommon.Config {
98
- securityDefinitions := spec.SecurityDefinitions {}
99
- securityDefinitions ["BearerToken" ] = & spec.SecurityScheme {
100
- SecuritySchemeProps : spec.SecuritySchemeProps {
101
- Type : "apiKey" ,
102
- Name : "authorization" ,
103
- In : "header" ,
104
- Description : "Bearer Token authentication" ,
105
95
},
106
96
}
97
+
98
+ ignorePrefixes = []string {"/swaggerapi" , "/healthz" , "/controllers" , "/metrics" , "/version/openshift" , "/brokers" }
99
+ )
100
+
101
+ func DefaultOpenAPIConfig () * openapicommon.Config {
107
102
defNamer := apiserverendpointsopenapi .NewDefinitionNamer (legacyscheme .Scheme , extensionsapiserver .Scheme , aggregatorscheme .Scheme )
108
- return & openapicommon.Config {
109
- ProtocolList : []string {"https" },
110
- GetDefinitions : openapigenerated .GetOpenAPIDefinitions ,
111
- IgnorePrefixes : []string {"/swaggerapi" , "/healthz" , "/controllers" , "/metrics" , "/version/openshift" , "/brokers" },
112
- GetDefinitionName : defNamer .GetDefinitionName ,
113
- Info : & specInfo ,
114
- DefaultResponse : & spec.Response {
115
- ResponseProps : spec.ResponseProps {
116
- Description : "Default Response." ,
103
+ cfg := genericapiserver .DefaultOpenAPIConfig (openapigenerated .GetOpenAPIDefinitions , defNamer )
104
+ cfg .Info = & specInfo
105
+ cfg .IgnorePrefixes = ignorePrefixes
106
+ cfg .SecurityDefinitions = & spec.SecurityDefinitions {
107
+ "BearerToken" : & spec.SecurityScheme {
108
+ SecuritySchemeProps : spec.SecuritySchemeProps {
109
+ Type : "apiKey" ,
110
+ Name : "authorization" ,
111
+ In : "header" ,
112
+ Description : "Bearer Token authentication" ,
117
113
},
118
114
},
119
- SecurityDefinitions : & securityDefinitions ,
120
115
}
116
+
117
+ return cfg
121
118
}
122
119
123
120
func DefaultOpenAPIV3Config () * openapicommon.OpenAPIV3Config {
124
121
defNamer := apiserverendpointsopenapi .NewDefinitionNamer (legacyscheme .Scheme , extensionsapiserver .Scheme , aggregatorscheme .Scheme )
125
122
cfg := genericapiserver .DefaultOpenAPIV3Config (openapigenerated .GetOpenAPIDefinitions , defNamer )
126
123
cfg .Info = & specInfo
127
- cfg .IgnorePrefixes = [] string { "/swaggerapi" , "/healthz" , "/controllers" , "/metrics" , "/version/openshift" , "/brokers" }
128
- cfg .SecuritySchemes = map [ string ] * spec3.SecurityScheme {
129
- "BearerToken" : {
124
+ cfg .IgnorePrefixes = ignorePrefixes
125
+ cfg .SecuritySchemes = spec3.SecuritySchemes {
126
+ "BearerToken" : & spec3. SecurityScheme {
130
127
SecuritySchemeProps : spec3.SecuritySchemeProps {
131
128
Type : "apiKey" ,
132
129
Name : "authorization" ,
0 commit comments