mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2024-11-24 08:52:25 +02:00
42475c28f7
* Initial commit of multiple provider logic: 1. Created new provider options. 2. Created legacy provider options and conversion options. 3. Added Providers to alpha Options. 4. Started Validation migration of multiple providers 5. Tests. * fixed lint issues * additional lint fixes * Nits and alterations based on CR: manliy splitting large providers validation function and adding comments to provider options * fixed typo * removed weird : file * small CR changes * Removed GoogleGroups validation due to new allowed-groups (including tests). Added line in CHANGELOG * Update pkg/apis/options/providers.go Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk> * Update pkg/apis/options/providers.go Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk> * Update pkg/apis/options/providers.go Co-authored-by: Nick Meves <nick.meves@greenhouse.io> * Initial commit of multiple provider logic: 1. Created new provider options. 2. Created legacy provider options and conversion options. 3. Added Providers to alpha Options. 4. Started Validation migration of multiple providers 5. Tests. * fixed lint issues * additional lint fixes * Nits and alterations based on CR: manliy splitting large providers validation function and adding comments to provider options * small CR changes * auto generates alpha_config.md * rebase (mainly service alpha options related conflicts) * removed : * Nits and alterations based on CR: manliy splitting large providers validation function and adding comments to provider options * small CR changes * Removed GoogleGroups validation due to new allowed-groups (including tests). Added line in CHANGELOG * "cntd. rebase" * ran make generate again * last conflicts * removed duplicate client id validation * 1. Removed provider prefixes 2. altered optionsWithNilProvider logic 3. altered default provider logic 4. moved change in CHANELOG to 7.0.0 * fixed TestGoogleGroupOptions test * ran make generate * moved CHANGLOG line to 7.1.1 * moved changelog comment to 7.1.2 (additional rebase) Co-authored-by: Yana Segal <yana.segal@nielsen.com> Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk> Co-authored-by: Nick Meves <nick.meves@greenhouse.io>
70 lines
2.9 KiB
Go
70 lines
2.9 KiB
Go
package options
|
|
|
|
// AlphaOptions contains alpha structured configuration options.
|
|
// Usage of these options allows users to access alpha features that are not
|
|
// available as part of the primary configuration structure for OAuth2 Proxy.
|
|
//
|
|
// :::warning
|
|
// The options within this structure are considered alpha.
|
|
// They may change between releases without notice.
|
|
// :::
|
|
type AlphaOptions struct {
|
|
// Upstreams is used to configure upstream servers.
|
|
// Once a user is authenticated, requests to the server will be proxied to
|
|
// these upstream servers based on the path mappings defined in this list.
|
|
Upstreams Upstreams `json:"upstreams,omitempty"`
|
|
|
|
// InjectRequestHeaders is used to configure headers that should be added
|
|
// to requests to upstream servers.
|
|
// Headers may source values from either the authenticated user's session
|
|
// or from a static secret value.
|
|
InjectRequestHeaders []Header `json:"injectRequestHeaders,omitempty"`
|
|
|
|
// InjectResponseHeaders is used to configure headers that should be added
|
|
// to responses from the proxy.
|
|
// This is typically used when using the proxy as an external authentication
|
|
// provider in conjunction with another proxy such as NGINX and its
|
|
// auth_request module.
|
|
// Headers may source values from either the authenticated user's session
|
|
// or from a static secret value.
|
|
InjectResponseHeaders []Header `json:"injectResponseHeaders,omitempty"`
|
|
|
|
// Server is used to configure the HTTP(S) server for the proxy application.
|
|
// You may choose to run both HTTP and HTTPS servers simultaneously.
|
|
// This can be done by setting the BindAddress and the SecureBindAddress simultaneously.
|
|
// To use the secure server you must configure a TLS certificate and key.
|
|
Server Server `json:"server,omitempty"`
|
|
|
|
// MetricsServer is used to configure the HTTP(S) server for metrics.
|
|
// You may choose to run both HTTP and HTTPS servers simultaneously.
|
|
// This can be done by setting the BindAddress and the SecureBindAddress simultaneously.
|
|
// To use the secure server you must configure a TLS certificate and key.
|
|
MetricsServer Server `json:"metricsServer,omitempty"`
|
|
|
|
// Providers is used to configure multiple providers.
|
|
Providers Providers `json:"providers,omitempty"`
|
|
}
|
|
|
|
// MergeInto replaces alpha options in the Options struct with the values
|
|
// from the AlphaOptions
|
|
func (a *AlphaOptions) MergeInto(opts *Options) {
|
|
opts.UpstreamServers = a.Upstreams
|
|
opts.InjectRequestHeaders = a.InjectRequestHeaders
|
|
opts.InjectResponseHeaders = a.InjectResponseHeaders
|
|
opts.Server = a.Server
|
|
opts.MetricsServer = a.MetricsServer
|
|
opts.Providers = a.Providers
|
|
|
|
}
|
|
|
|
// ExtractFrom populates the fields in the AlphaOptions with the values from
|
|
// the Options
|
|
func (a *AlphaOptions) ExtractFrom(opts *Options) {
|
|
a.Upstreams = opts.UpstreamServers
|
|
a.InjectRequestHeaders = opts.InjectRequestHeaders
|
|
a.InjectResponseHeaders = opts.InjectResponseHeaders
|
|
a.Server = opts.Server
|
|
a.MetricsServer = opts.MetricsServer
|
|
a.Providers = opts.Providers
|
|
}
|