// UaaPassword builds an OauthStrategy for UAA using password_grant token requests
972785
func UaaPassword(clientId, clientSecret, username, password string) Builder {
	return Uaa(clientId, clientSecret, username, password, "", "", false)
}
1327518
func (a *Authenticator) AuthenticatePassword(ctx context.Context, username, password string) (*authenticator.Response, bool, error) {
	identity, ok, err := a.getIdentity(username, password)
	if err != nil {
		return nil, false, err
	}
	if !ok {
		return nil, false, nil
	}

	return identitymapper.ResponseFor(a.mapper, identity)
}
702808
func (as *AuthenticationService) UsingGithubToken(githubToken string) (AccessToken, *http.Response, error) {
	if githubToken == "" {
		return "", nil, fmt.Errorf("unable to authenticate client; empty github token provided")
	}
	var u string = "/auth/github"
	var b map[string]string = map[string]string{"github_token": githubToken}

	req, err := as.client.NewRequest("POST", u, b, nil)
	if err != nil {
		return "", nil, err
	}

	atr := &accessTokenResponse{}
	resp, err := as.client.Do(req, atr)
	if err != nil {
		return "", nil, err
	}

	as.UsingTravisToken(string(atr.Token))

	return atr.Token, resp, err
}
254857
func (client *SSHClient) GetSSHPassword() string {
	client.Creds.mu.Lock()
	defer client.Creds.mu.Unlock()
	return client.Creds.SSHPassword
}
627379
func hashAuth(u, p string) string {
	var a = fmt.Sprintf("%s:%s", u, p)
	return base64.StdEncoding.EncodeToString([]byte(a))
}
1200263
func (s *HostService) UpdateHostPassword(p *UpdateHostPasswordParams) (*UpdateHostPasswordResponse, error) {
	resp, err := s.cs.newRequest("updateHostPassword", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r UpdateHostPasswordResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
1039761
func (c *Client) VoidAuthorization(authID string) (*Authorization, error) {
	buf := bytes.NewBuffer([]byte(""))
	req, err := http.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v2/payments/authorization/"+authID+"/void"), buf)
	if err != nil {
		return &Authorization{}, err
	}

	auth := &Authorization{}
	err = c.SendWithAuth(req, auth)
	return auth, err
}
681731
func CalcPassword(scramble, sha1pwd []byte) []byte {
	if len(sha1pwd) == 0 {
		return nil
	}
	// scrambleHash = SHA1(scramble + SHA1(sha1pwd))
	// inner Hash
	hash := Sha1Hash(sha1pwd)
	// outer Hash
	crypt := sha1.New()
	crypt.Write(scramble)
	crypt.Write(hash)
	scramble = crypt.Sum(nil)
	// token = scrambleHash XOR stage1Hash
	for i := range scramble {
		scramble[i] ^= sha1pwd[i]
	}
	return scramble
}
1302183
func ParseOAuthToken(response string) (*OAuthToken, error) {
	val, err := url.ParseQuery(strings.TrimSpace(response))
	if err != nil {
		return nil, err
	}

	ret := &OAuthToken{}

	oauth_problem := val.Get("oauth_problem")
	if oauth_problem != "" {
		ret.OAuthProblem = oauth_problem
		return ret, flickErr.NewError(flickErr.OAuthTokenError, oauth_problem)
	}

	ret.OAuthToken = val.Get("oauth_token")
	ret.OAuthTokenSecret = val.Get("oauth_token_secret")
	ret.Fullname = val.Get("fullname")
	ret.UserNsid = val.Get("user_nsid")
	ret.Username = val.Get("username")

	return ret, nil
}
815786
func Auth(secret string) (*Command, error) {
	return &Command{[]byte("AUTH"), nil, []byte(secret)}, nil
}
1121428
func (n *nomadFSM) applyACLTokenUpsert(buf []byte, index uint64) interface{} {
	defer metrics.MeasureSince([]string{"nomad", "fsm", "apply_acl_token_upsert"}, time.Now())
	var req structs.ACLTokenUpsertRequest
	if err := structs.Decode(buf, &req); err != nil {
		panic(fmt.Errorf("failed to decode request: %v", err))
	}

	if err := n.state.UpsertACLTokens(index, req.Tokens); err != nil {
		n.logger.Error("UpsertACLTokens failed", "error", err)
		return err
	}
	return nil
}
990105
func (s *AuthServer) CheckPassword(user string, password []byte, otpToken string) error {
	err := s.CheckPasswordWOToken(user, password)
	if err != nil {
		return trace.Wrap(err)
	}

	err = s.CheckOTP(user, otpToken)
	return trace.Wrap(err)
}
632980
func ParseAccessTokenStr(str string) (*AccessToken, error) {
	token := AccessToken{}
	token.params = map[string]string{}

	//parse the request token from the body
	parts, err := url.ParseQuery(str)
	if err != nil {
		return nil, err
	}

	//loop through parts to create Token
	for key, val := range parts {
		switch key {
		case "oauth_token"        : token.token = val[0]
		case "oauth_token_secret" : token.secret = val[0]
		default                   : token.params[key] = val[0]
		}
	}

	//some error checking ...
	switch {
	case len(token.token) == 0  : return nil, errors.New(str)
	case len(token.secret) == 0 : return nil, errors.New(str)
	}

	return &token, nil
}
2157
func (c AccountClient) PassphraseCheck(ctx context.Context, __arg PassphraseCheckArg) (res bool, err error) {
	err = c.Cli.Call(ctx, "keybase.1.account.passphraseCheck", []interface{}{__arg}, &res)
	return
}
167630
func (c *V1) HasBcryptPasswords() (bool, error) {
	if err := c.EnsureInit(); err != nil {
		return false, err
	}
	for _, pass := range c.users {
		if pass.passwordType() == passwordTypeBcrypt {
			return true, nil
		}
	}
	return false, nil
}
1197003
func Token(ctx context.Context) *AuthorizationToken {
	v := ctx.Value(tokenIndex)
	if v == nil {
		return nil
	}
	return v.(*AuthorizationToken)
}
504932
func (*denyAuthenticator) AuthenticatePassword(ctx context.Context, user, password string) (*authenticator.Response, bool, error) {
	return nil, false, nil
}