// Code generated by applyconfiguration-gen. DO NOT EDIT.

package v1

// RequestHeaderIdentityProviderApplyConfiguration represents a declarative configuration of the RequestHeaderIdentityProvider type for use
// with apply.
//
// RequestHeaderIdentityProvider provides identities for users authenticating using request header credentials
type RequestHeaderIdentityProviderApplyConfiguration struct {
	// loginURL is a URL to redirect unauthenticated /authorize requests to
	// Unauthenticated requests from OAuth clients which expect interactive logins will be redirected here
	// ${url} is replaced with the current URL, escaped to be safe in a query parameter
	// https://www.example.com/sso-login?then=${url}
	// ${query} is replaced with the current query string
	// https://www.example.com/auth-proxy/oauth/authorize?${query}
	// Required when login is set to true.
	LoginURL *string `json:"loginURL,omitempty"`
	// challengeURL is a URL to redirect unauthenticated /authorize requests to
	// Unauthenticated requests from OAuth clients which expect WWW-Authenticate challenges will be
	// redirected here.
	// ${url} is replaced with the current URL, escaped to be safe in a query parameter
	// https://www.example.com/sso-login?then=${url}
	// ${query} is replaced with the current query string
	// https://www.example.com/auth-proxy/oauth/authorize?${query}
	// Required when challenge is set to true.
	ChallengeURL *string `json:"challengeURL,omitempty"`
	// ca is a required reference to a config map by name containing the PEM-encoded CA bundle.
	// It is used as a trust anchor to validate the TLS certificate presented by the remote server.
	// Specifically, it allows verification of incoming requests to prevent header spoofing.
	// The key "ca.crt" is used to locate the data.
	// If the config map or expected key is not found, the identity provider is not honored.
	// If the specified ca data is not valid, the identity provider is not honored.
	// The namespace for this config map is openshift-config.
	ClientCA *ConfigMapNameReferenceApplyConfiguration `json:"ca,omitempty"`
	// clientCommonNames is an optional list of common names to require a match from. If empty, any
	// client certificate validated against the clientCA bundle is considered authoritative.
	ClientCommonNames []string `json:"clientCommonNames,omitempty"`
	// headers is the set of headers to check for identity information
	Headers []string `json:"headers,omitempty"`
	// preferredUsernameHeaders is the set of headers to check for the preferred username
	PreferredUsernameHeaders []string `json:"preferredUsernameHeaders,omitempty"`
	// nameHeaders is the set of headers to check for the display name
	NameHeaders []string `json:"nameHeaders,omitempty"`
	// emailHeaders is the set of headers to check for the email address
	EmailHeaders []string `json:"emailHeaders,omitempty"`
}

// RequestHeaderIdentityProviderApplyConfiguration constructs a declarative configuration of the RequestHeaderIdentityProvider type for use with
// apply.
func RequestHeaderIdentityProvider() *RequestHeaderIdentityProviderApplyConfiguration {
	return &RequestHeaderIdentityProviderApplyConfiguration{}
}

// WithLoginURL sets the LoginURL field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the LoginURL field is set to the value of the last call.
func (b *RequestHeaderIdentityProviderApplyConfiguration) WithLoginURL(value string) *RequestHeaderIdentityProviderApplyConfiguration {
	b.LoginURL = &value
	return b
}

// WithChallengeURL sets the ChallengeURL field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ChallengeURL field is set to the value of the last call.
func (b *RequestHeaderIdentityProviderApplyConfiguration) WithChallengeURL(value string) *RequestHeaderIdentityProviderApplyConfiguration {
	b.ChallengeURL = &value
	return b
}

// WithClientCA sets the ClientCA field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the ClientCA field is set to the value of the last call.
func (b *RequestHeaderIdentityProviderApplyConfiguration) WithClientCA(value *ConfigMapNameReferenceApplyConfiguration) *RequestHeaderIdentityProviderApplyConfiguration {
	b.ClientCA = value
	return b
}

// WithClientCommonNames adds the given value to the ClientCommonNames field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the ClientCommonNames field.
func (b *RequestHeaderIdentityProviderApplyConfiguration) WithClientCommonNames(values ...string) *RequestHeaderIdentityProviderApplyConfiguration {
	for i := range values {
		b.ClientCommonNames = append(b.ClientCommonNames, values[i])
	}
	return b
}

// WithHeaders adds the given value to the Headers field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Headers field.
func (b *RequestHeaderIdentityProviderApplyConfiguration) WithHeaders(values ...string) *RequestHeaderIdentityProviderApplyConfiguration {
	for i := range values {
		b.Headers = append(b.Headers, values[i])
	}
	return b
}

// WithPreferredUsernameHeaders adds the given value to the PreferredUsernameHeaders field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the PreferredUsernameHeaders field.
func (b *RequestHeaderIdentityProviderApplyConfiguration) WithPreferredUsernameHeaders(values ...string) *RequestHeaderIdentityProviderApplyConfiguration {
	for i := range values {
		b.PreferredUsernameHeaders = append(b.PreferredUsernameHeaders, values[i])
	}
	return b
}

// WithNameHeaders adds the given value to the NameHeaders field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the NameHeaders field.
func (b *RequestHeaderIdentityProviderApplyConfiguration) WithNameHeaders(values ...string) *RequestHeaderIdentityProviderApplyConfiguration {
	for i := range values {
		b.NameHeaders = append(b.NameHeaders, values[i])
	}
	return b
}

// WithEmailHeaders adds the given value to the EmailHeaders field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the EmailHeaders field.
func (b *RequestHeaderIdentityProviderApplyConfiguration) WithEmailHeaders(values ...string) *RequestHeaderIdentityProviderApplyConfiguration {
	for i := range values {
		b.EmailHeaders = append(b.EmailHeaders, values[i])
	}
	return b
}
