// APIKeyAuth provides an API key auth info writer
499131
func APIKeyAuth(name, in, value string) runtime.ClientAuthInfoWriter {
	if in == "query" {
		return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error {
			return r.SetQueryParam(name, value)
		})
	}

	if in == "header" {
		return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error {
			return r.SetHeaderParam(name, value)
		})
	}
	return nil
}
976398
func (s *UpdateVirtualInterfaceAttributesOutput) SetAuthKey(v string) *UpdateVirtualInterfaceAttributesOutput {
	s.AuthKey = &v
	return s
}
546640
func NewAPIKeyAuthorizer(headers map[string]interface{}, queryParameters map[string]interface{}) *APIKeyAuthorizer {
	return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters}
}
770624
func APIKeyAuth(name, in string, authenticate TokenAuthentication) runtime.Authenticator {
	inl := strings.ToLower(in)
	if inl != query && inl != header {
		// panic because this is most likely a typo
		panic(errors.New(500, "api key auth: in value needs to be either \"query\" or \"header\"."))
	}

	var getToken func(*http.Request) string
	switch inl {
	case header:
		getToken = func(r *http.Request) string { return r.Header.Get(name) }
	case query:
		getToken = func(r *http.Request) string { return r.URL.Query().Get(name) }
	}

	return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) {
		token := getToken(r)
		if token == "" {
			return false, nil, nil
		}

		p, err := authenticate(token)
		return true, p, err
	})
}
606023
func Auth(username, password string) registry.Option {
	return func(o *registry.Options) {
		if o.Context == nil {
			o.Context = context.Background()
		}
		o.Context = context.WithValue(o.Context, authKey{}, &authCreds{Username: username, Password: password})
	}
}
507123
func (apiutil *ClientUtil) GetUserinfo() (*AhaUserinfo, error) {
	resp, err := apiutil.Client.Get(APIMeURL)
	if err != nil {
		return nil, err
	} else if resp.StatusCode >= 300 {
		return nil, fmt.Errorf("Aha.io API returned Status Code %v", resp.StatusCode)
	}

	bodyBytes, err := hum.ResponseBody(resp)
	if err != nil {
		return nil, err
	}

	userinfo := AhaUserinfoWrap{}
	err = json.Unmarshal(bodyBytes, &userinfo)
	if err == nil {
		apiutil.User = userinfo.User
	}
	return userinfo.User, err
}
191387
func (s *S3Storage) Auth() (auth aws.Auth, err error) {
	return aws.GetAuth(s.AccessKeyId, s.SecretAccessKey)
}
666691
func WrapAuth(auth Authenticater, handle http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		if auth.Authenticate(r) {
			handle(w, r)
		} else {
			w.WriteHeader(http.StatusUnauthorized)
		}
	}
}
468887
func NewAPI(rawurl, key, secret string) (*API, error) {
	client := oauth.NewConsumer(key, secret, oauth.ServiceProvider{})
	token := &oauth.AccessToken{}

	parsed, err := url.Parse(rawurl)
	if err != nil {
		return nil, err
	}

	return &API{
		url:    parsed,
		client: client,
		token:  token,
	}, nil
}
775017
func (c *RPCClient) auth(authKey string) error {
	header := requestHeader{
		Command: authCommand,
		Seq:     c.getSeq(),
	}
	req := authRequest{
		AuthKey: authKey,
	}
	return c.genericRPC(&header, &req, nil)
}
341427
func (c *Client) GoogleAuth(oauthToken string, handler func(jwtToken string) error) error {
	_, err := c.conn.SendRequest("auth.google", map[string]string{"token": oauthToken}, func(ctx *neptulon.ResCtx) error {
		var jwtToken map[string]string
		if err := ctx.Result(&jwtToken); err != nil {
			return fmt.Errorf("client: auth.google: error reading response: %v", err)
		}
		return handler(jwtToken["token"])
	})

	if err != nil {
		return fmt.Errorf("client: auth.google: error sending request: %v", err)
	}

	return nil
}
407187
func EncodeAuth(a *AuthConfig) string {
	authStr := a.Username + ":" + a.Password
	msg := []byte(authStr)
	encoded := make([]byte, base64.StdEncoding.EncodedLen(len(msg)))
	base64.StdEncoding.Encode(encoded, msg)
	return string(encoded)
}
417800
func (s *VirtualInterface) SetAuthKey(v string) *VirtualInterface {
	s.AuthKey = &v
	return s
}
944330
func (s *NewTransitVirtualInterface) SetAuthKey(v string) *NewTransitVirtualInterface {
	s.AuthKey = &v
	return s
}
1316947
func NewAuthKey(KEY [32]uint8) *AuthKey {
	m := AuthKey{}
	m.KEY = KEY
	return &m
}
1042064
func (c *Clientset) Oauth() oauthinternalversion.OauthInterface {
	return &fakeoauthinternalversion.FakeOauth{Fake: &c.Fake}
}
818164
func (c *Client) SupportAuth(mech string) (bool, error) {
	return c.Support("AUTH=" + mech)
}