|
|
@@ -137,6 +137,9 @@ type Config struct {
|
|
|
|
// RequestContextMapper maps requests to contexts. Exported so downstream consumers can provider their own mappers
|
|
|
|
// RequestContextMapper maps requests to contexts. Exported so downstream consumers can provider their own mappers
|
|
|
|
// TODO confirm that anyone downstream actually uses this and doesn't just need an accessor
|
|
|
|
// TODO confirm that anyone downstream actually uses this and doesn't just need an accessor
|
|
|
|
RequestContextMapper apirequest.RequestContextMapper
|
|
|
|
RequestContextMapper apirequest.RequestContextMapper
|
|
|
|
|
|
|
|
// RequestInfoResolver is used to assign attributes (used by admission and authorization) based on a request URL.
|
|
|
|
|
|
|
|
// Use-cases that are like kubelets may need to customize this.
|
|
|
|
|
|
|
|
RequestInfoResolver apirequest.RequestInfoResolver
|
|
|
|
// Serializer is required and provides the interface for serializing and converting objects to and from the wire
|
|
|
|
// Serializer is required and provides the interface for serializing and converting objects to and from the wire
|
|
|
|
// The default (api.Codecs) usually works fine.
|
|
|
|
// The default (api.Codecs) usually works fine.
|
|
|
|
Serializer runtime.NegotiatedSerializer
|
|
|
|
Serializer runtime.NegotiatedSerializer
|
|
|
@@ -369,6 +372,10 @@ func (c *Config) Complete() completedConfig {
|
|
|
|
c.Authorizer = authorizerunion.New(tokenAuthorizer, c.Authorizer)
|
|
|
|
c.Authorizer = authorizerunion.New(tokenAuthorizer, c.Authorizer)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if c.RequestInfoResolver == nil {
|
|
|
|
|
|
|
|
c.RequestInfoResolver = NewRequestInfoResolver(c)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return completedConfig{c}
|
|
|
|
return completedConfig{c}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@@ -482,7 +489,7 @@ func DefaultBuildHandlerChain(apiHandler http.Handler, c *Config) http.Handler {
|
|
|
|
handler = genericapifilters.WithAuthentication(handler, c.RequestContextMapper, c.Authenticator, genericapifilters.Unauthorized(c.RequestContextMapper, c.Serializer, c.SupportsBasicAuth))
|
|
|
|
handler = genericapifilters.WithAuthentication(handler, c.RequestContextMapper, c.Authenticator, genericapifilters.Unauthorized(c.RequestContextMapper, c.Serializer, c.SupportsBasicAuth))
|
|
|
|
handler = genericfilters.WithCORS(handler, c.CorsAllowedOriginList, nil, nil, nil, "true")
|
|
|
|
handler = genericfilters.WithCORS(handler, c.CorsAllowedOriginList, nil, nil, nil, "true")
|
|
|
|
handler = genericfilters.WithTimeoutForNonLongRunningRequests(handler, c.RequestContextMapper, c.LongRunningFunc, c.RequestTimeout)
|
|
|
|
handler = genericfilters.WithTimeoutForNonLongRunningRequests(handler, c.RequestContextMapper, c.LongRunningFunc, c.RequestTimeout)
|
|
|
|
handler = genericapifilters.WithRequestInfo(handler, NewRequestInfoResolver(c), c.RequestContextMapper)
|
|
|
|
handler = genericapifilters.WithRequestInfo(handler, c.RequestInfoResolver, c.RequestContextMapper)
|
|
|
|
handler = apirequest.WithRequestContext(handler, c.RequestContextMapper)
|
|
|
|
handler = apirequest.WithRequestContext(handler, c.RequestContextMapper)
|
|
|
|
handler = genericfilters.WithPanicRecovery(handler)
|
|
|
|
handler = genericfilters.WithPanicRecovery(handler)
|
|
|
|
return handler
|
|
|
|
return handler
|
|
|
|