// Convert_v1_BasicAuthPasswordIdentityProvider_To_config_BasicAuthPasswordIdentityProvider is an autogenerated conversion function.
972624
func Convert_v1_BasicAuthPasswordIdentityProvider_To_config_BasicAuthPasswordIdentityProvider(in *v1.BasicAuthPasswordIdentityProvider, out *config.BasicAuthPasswordIdentityProvider, s conversion.Scope) error {
	return autoConvert_v1_BasicAuthPasswordIdentityProvider_To_config_BasicAuthPasswordIdentityProvider(in, out, s)
}
1184193
func Convert_config_EncryptionConfiguration_To_v1_EncryptionConfiguration(in *config.EncryptionConfiguration, out *EncryptionConfiguration, s conversion.Scope) error {
	return autoConvert_config_EncryptionConfiguration_To_v1_EncryptionConfiguration(in, out, s)
}
145433
func Convert_v1_WebhookTokenAuthenticator_To_config_WebhookTokenAuthenticator(in *v1.WebhookTokenAuthenticator, out *config.WebhookTokenAuthenticator, s conversion.Scope) error {
	return autoConvert_v1_WebhookTokenAuthenticator_To_config_WebhookTokenAuthenticator(in, out, s)
}
102221
func Convert_v1_GitHubIdentityProvider_To_config_GitHubIdentityProvider(in *v1.GitHubIdentityProvider, out *config.GitHubIdentityProvider, s conversion.Scope) error {
	return autoConvert_v1_GitHubIdentityProvider_To_config_GitHubIdentityProvider(in, out, s)
}
91545
func Convert_config_RequestHeaderIdentityProvider_To_v1_RequestHeaderIdentityProvider(in *config.RequestHeaderIdentityProvider, out *v1.RequestHeaderIdentityProvider, s conversion.Scope) error {
	return autoConvert_config_RequestHeaderIdentityProvider_To_v1_RequestHeaderIdentityProvider(in, out, s)
}
211342
func Convert_user_Identity_To_v1_Identity(in *user.Identity, out *v1.Identity, s conversion.Scope) error {
	return autoConvert_user_Identity_To_v1_Identity(in, out, s)
}
535606
func Convert_v1beta1_KubeletAuthentication_To_config_KubeletAuthentication(in *v1beta1.KubeletAuthentication, out *config.KubeletAuthentication, s conversion.Scope) error {
	return autoConvert_v1beta1_KubeletAuthentication_To_config_KubeletAuthentication(in, out, s)
}
1048775
func Convert_v1_AllowAllPasswordIdentityProvider_To_config_AllowAllPasswordIdentityProvider(in *v1.AllowAllPasswordIdentityProvider, out *config.AllowAllPasswordIdentityProvider, s conversion.Scope) error {
	return autoConvert_v1_AllowAllPasswordIdentityProvider_To_config_AllowAllPasswordIdentityProvider(in, out, s)
}
379396
func BasicAuth(username, passwd string) ConfigOpt {
	// TODO(jdef) this could be more efficient. according to the stdlib we're not supposed to
	// mutate the original Request, so we copy here (including headers). another approach would
	// be to generate a functional RequestOpt that adds the right header.
	return WrapRoundTripper(func(rt http.RoundTripper) http.RoundTripper {
		return roundTripperFunc(func(req *http.Request) (*http.Response, error) {
			var h http.Header
			if req.Header != nil {
				h = make(http.Header, len(req.Header))
				for k, v := range req.Header {
					h[k] = append(make([]string, 0, len(v)), v...)
				}
			}
			clonedReq := *req
			clonedReq.Header = h
			clonedReq.SetBasicAuth(username, passwd)
			return rt.RoundTrip(&clonedReq)
		})
	})
}
763819
func (c *Context) OAuthProvider() *OAuthProvider {

	service := c.Service()
	if c.ServiceBaseURL.Host == "" || c.ServiceBaseURL.Host == service.DefaultBaseURL.Host {
		return service.DefaultOAuthProvider()
	} else if c.ServiceBaseURL.Host != "" {

		p, _ := findOauthProviderByHost(c.db, c.ServiceBaseURL.Host)
		if p == nil {
			p = &OAuthProvider{BaseURL: c.ServiceBaseURL, Service: c.ServiceName}
		}
		/*if err != nil {
			c.Log().WithError(err).WithField("host", c.ServiceBaseURL.Host).Error("Can't get OAuthProvider")
		}*/

		return p
	}
	c.Log().Error("Can't get OAuthProvider – empty ServiceBaseURL")

	return nil
}
1267699
func Convert_config_GitLabIdentityProvider_To_v1_GitLabIdentityProvider(in *config.GitLabIdentityProvider, out *v1.GitLabIdentityProvider, s conversion.Scope) error {
	return autoConvert_config_GitLabIdentityProvider_To_v1_GitLabIdentityProvider(in, out, s)
}
771222
func Convert_v1_DenyAllPasswordIdentityProvider_To_config_DenyAllPasswordIdentityProvider(in *v1.DenyAllPasswordIdentityProvider, out *config.DenyAllPasswordIdentityProvider, s conversion.Scope) error {
	return autoConvert_v1_DenyAllPasswordIdentityProvider_To_config_DenyAllPasswordIdentityProvider(in, out, s)
}
212613
func Convert_v1_OpenIDURLs_To_config_OpenIDURLs(in *v1.OpenIDURLs, out *config.OpenIDURLs, s conversion.Scope) error {
	return autoConvert_v1_OpenIDURLs_To_config_OpenIDURLs(in, out, s)
}
808264
func Convert_v1_UserInfo_To_authentication_UserInfo(in *v1.UserInfo, out *authentication.UserInfo, s conversion.Scope) error {
	return autoConvert_v1_UserInfo_To_authentication_UserInfo(in, out, s)
}
62679
func (r *RequestConfig) BasicAuth(username, password string) *RequestConfig {
	r.User = username
	r.Password = password
	return r
}
531757
func Convert_v1_RequestHeaderIdentityProvider_To_config_RequestHeaderIdentityProvider(in *v1.RequestHeaderIdentityProvider, out *config.RequestHeaderIdentityProvider, s conversion.Scope) error {
	return autoConvert_v1_RequestHeaderIdentityProvider_To_config_RequestHeaderIdentityProvider(in, out, s)
}
1052157
func Convert_config_MasterAuthConfig_To_v1_MasterAuthConfig(in *config.MasterAuthConfig, out *v1.MasterAuthConfig, s conversion.Scope) error {
	return autoConvert_config_MasterAuthConfig_To_v1_MasterAuthConfig(in, out, s)
}