// NewClientPasswordSimple uses OAuth2 package password grant handling.
979165
func NewClientPasswordSimple(app ApplicationCredentials, user UserCredentials) (*http.Client, error) {
	httpClient, err := om.NewClientPasswordConf(
		oauth2.Config{
			ClientID:     app.ClientID,
			ClientSecret: app.ClientSecret,
			Endpoint:     NewEndpoint(app.ServerURL)},
		user.UsernameSimple(),
		user.Password)
	if err != nil {
		return nil, err
	}

	header := getClientHeader(app)
	if len(header) > 0 {
		httpClient.Transport = hum.TransportWithHeaders{
			Transport: httpClient.Transport,
			Header:    header}
	}
	return httpClient, nil
}
962797
func NewMultiUserClient(user string, password string, key string, accountEmail string) *Client {
	config := ClientConfig{
		User:         user,
		Password:     password,
		APIKey:       key,
		AccountEmail: accountEmail,
	}
	c, _ := NewClientWithConfig(config)
	return c
}
1158135
func NewClient(apiKey string, apiSecret string) (*Client, error) {
	if apiKey == "" {
		return nil, fmt.Errorf("credentials missing: API key")
	}

	if apiSecret == "" {
		return nil, fmt.Errorf("credentials missing: API secret")
	}

	return &Client{
		apiKey:     apiKey,
		apiSecret:  apiSecret,
		HTTPClient: &http.Client{},
	}, nil
}
1199460
func NewClient(
	accessToken string,
	clientID string,
	apiURL string,
	logger logger.Logger,
) wl.Client {
	return &oauthClient{
		apiURL:      apiURL,
		accessToken: accessToken,
		clientID:    clientID,
		logger:      logger,
	}
}
648060
func NewClient(accessKeyID, accessKeySecret string) *Client {
	c := new(Client)
	c.AccessKeyID = accessKeyID
	c.AccessKeySecret = accessKeySecret

	return c
}
1196374
func PromptNewPassphrase(g *libkb.GlobalContext) (string, error) {
	arg := libkb.DefaultPassphraseArg(libkb.NewMetaContextTODO(g))
	arg.WindowTitle = "Pick a new passphrase"
	arg.Prompt = fmt.Sprintf("Pick a new strong passphrase (%d+ characters)", libkb.MinPassphraseLength)
	arg.Type = keybase1.PassphraseType_VERIFY_PASS_PHRASE
	res, err := promptPassphraseWithArg(g, arg, "Please reenter your new passphrase for confirmation")
	if err != nil {
		return "", err
	}
	return res.Passphrase, nil
}
862461
func (ctx *SetupContext) NewOAuthClient(uris OAuthURIs) (*oauth.Client, error) {
	clientID, secret, err := ctx.Credentials()
	if err != nil {
		return nil, err
	}
	return &oauth.Client{
		TemporaryCredentialRequestURI: uris.TemporaryCredentialRequestURI,
		ResourceOwnerAuthorizationURI: uris.ResourceOwnerAuthorizationURI,
		TokenRequestURI:               uris.TokenRequestURI,
		Credentials: oauth.Credentials{
			Token:  clientID,
			Secret: secret,
		},
	}, nil
}
1299968
func NewClient(host string, port uint, passwd string, timeout int) (*Client, error) {
	client := Client{
		Proto:   "tcp", // Let me know if you ever need this open up lol
		Addr:    net.JoinHostPort(host, strconv.Itoa(int(port))),
		Passwd:  passwd,
		Timeout: timeout,
	}

	err := client.EstablishConnection()
	if err != nil {
		return nil, err
	}

	err = client.Authenticate()
	if err != nil {
		client.Close()
		return nil, err
	}

	return &client, nil
}
1172460
func NewClientBearerTokenSimple(accessToken string) *http.Client {
	token := &oauth2.Token{
		AccessToken: accessToken,
		TokenType:   BearerPrefix,
		Expiry:      timeutil.TimeRFC3339Zero()}

	oAuthConfig := &oauth2.Config{}

	return oAuthConfig.Client(oauth2.NoContext, token)
}
1082592
func NewClient(config *oauth2.Config) *Client {
	return &Client{
		Config:  config,
		backoff: backoff,
	}
}
730182
func NewPasswordResetType(Description string) *PasswordResetType {
	s := new(PasswordResetType)
	s.Description = Description
	return s
}
464818
func NewSimplePasswordHandler(vsm ValidatingSessionManager, cm CookieMapper) *SimplePasswordHandler {
	return &SimplePasswordHandler{
		vsm: vsm,
		cm:  cm,
	}
}
437954
func NewClientPassword(app ApplicationCredentials, pwd PasswordCredentials) (*http.Client, error) {
	c := app.Config()
	token, err := RetrieveToken(c, pwd.URLValues())
	if err != nil {
		return nil, err
	}

	httpClient := c.Client(oauth2.NoContext, token)

	header := getClientHeader(app)
	if len(header) > 0 {
		httpClient.Transport = hum.TransportWithHeaders{
			Transport: httpClient.Transport,
			Header:    header}
	}
	return httpClient, nil
}
1265126
func NewClient(email string, token string) (*Client, error) {
	client := Client{
		Token: token,
		Email: email,
		URL:   "https://api.dnsimple.com/v1",
		Http:  cleanhttp.DefaultClient(),
	}
	return &client, nil
}
790479
func NewClientCredentials(rootCAs *x509.CertPool, clientCerts []tls.Certificate, hostOverride string) credentials.TransportCredentials {
	return &clientTransportCredentials{rootCAs, clientCerts, hostOverride}
}
895153
func (f HashGeneratorFcn) NewClientUnprepped(username, password, authzID string) (*Client, error) {
	return newClient(username, password, authzID, f), nil
}
409550
func NewClient(region common.Region, internal bool, accessKeyId, accessKeySecret string) *Client {
	endpoint := os.Getenv("SLS_ENDPOINT")
	if endpoint == "" {
		endpoint = SLSDefaultEndpoint
	}
	return NewClientWithEndpoint(endpoint, region, internal, accessKeyId, accessKeySecret)
}