// GetUser - get user credentials
771445
func (sys *IAMSys) GetUser(accessKey string) (cred auth.Credentials, ok bool) {
	sys.RLock()
	defer sys.RUnlock()

	cred, ok = sys.iamUsersMap[accessKey]
	return cred, ok && cred.IsValid()
}
536351
func (provider *SoundcloudProvider) GetUser(creds *common.Credentials) (common.User, error) {

	profileData, err := provider.Get(creds, soundcloudEndpointProfile)

	if err != nil {
		return nil, err
	}

	// build user
	user := NewUser(profileData, creds, provider)

	return user, nil
}
904703
func (a *API) GetUser(user int) (*User, error) {
	dst := new(User)
	url := a.BuildURL("/v2/user/%d", user)
	err := a.Get(url, Params{}, dst)
	return dst, err
}
475994
func (_m *FacadeInterface) GetUser(ctx datastore.Context, userName string) (user.User, error) {
	ret := _m.Called(ctx, userName)

	var r0 user.User
	if rf, ok := ret.Get(0).(func(datastore.Context, string) user.User); ok {
		r0 = rf(ctx, userName)
	} else {
		r0 = ret.Get(0).(user.User)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(datastore.Context, string) error); ok {
		r1 = rf(ctx, userName)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
205095
func (c *Cache) GetUser(name string) (user services.User, err error) {
	u, err := c.usersCache.GetUser(name)
	if trace.IsNotFound(err) {
		return c.Users.GetUser(name)
	}
	return u, err
}
580236
func (us *UsersService) GetAuthenticated() (*User, *http.Response, error) {
	u, err := urlWithOptions("/users/", nil)
	if err != nil {
		return nil, nil, err
	}

	req, err := us.client.NewRequest("GET", u, nil, nil)
	if err != nil {
		return nil, nil, err
	}

	var userResp getUserResponse
	resp, err := us.client.Do(req, &userResp)
	if err != nil {
		return nil, resp, err
	}

	return &userResp.User, resp, err
}
504288
func GetUsers() []User {
	var userPagesResponse struct {
		NextURL   *string `json:"next_url"`
		Resources []struct {
			Metadata struct {
				GUID      string    `json:"guid"`
				CreatedAt time.Time `json:"created_at"`
			} `json:"metadata"`
			Entity struct {
				Username string `json:"username"`
			} `json:"entity"`
		} `json:"resources"`
	}

	var allUsers []User
	nextURL := "/v2/users?results-per-page=50"

	for {
		session := CF("curl", nextURL)
		Eventually(session).Should(Exit(0))

		err := json.Unmarshal(session.Out.Contents(), &userPagesResponse)
		Expect(err).NotTo(HaveOccurred())
		for _, resource := range userPagesResponse.Resources {
			allUsers = append(allUsers, User{
				GUID:      resource.Metadata.GUID,
				CreatedAt: resource.Metadata.CreatedAt,
				Username:  resource.Entity.Username,
			})
		}

		if userPagesResponse.NextURL == nil {
			break
		}
		nextURL = *userPagesResponse.NextURL
	}

	return allUsers
}
50675
func (a *API) GetUserConfig(user int, key string) (string, error) {
	url := a.BuildURL("/v2/user/%d/config/%s/", user, key)
	return a.getTextPlain(url, Params{})
}
704115
func (c *Cache) GetUsers() (users []services.User, err error) {
	return c.usersCache.GetUsers()
}
1306930
func GetCurrentUser(req *http.Request) *users.User {
	if currentUser, ok := auth.Auth.GetCurrentUser(req).(*users.User); ok {
		return currentUser
	}
	return nil
}
1077598
func (l *Client) GetUsers() ([]*AccountUser, error) {
	res := ApiResp{}
	data := []*AccountUser{}

	acct, err := l.GetAccount("current")
	if err != nil {
		// hm......
		return data, err
	}

	// make the request
	err = l.Get(userListEndpoint, nil, nil, &res, &data)
	if err != nil {
		return data, err
	}

	for _, user := range data {
		user.setup(&acct)
	}

	return data, nil
}
451260
func (provider *GithubProvider) GetUser(creds *common.Credentials) (common.User, error) {

	profileData, err := provider.Get(creds, githubEndpointProfile)

	if err != nil {
		return nil, err
	}

	// build user
	user := NewUser(profileData, creds, provider)

	return user, nil
}
1263528
func (a *Auth) GetLogin() (string, error) {
	if !a.parsed {
		a.parse()
	}

	return a.login, a.err
}
753904
func (service *Service) GetOauthUser(r *http.Request, w http.ResponseWriter) (username string, err error) {
	oauthSession, err := service.GetSession(r, SessionOauth, "oauthsession")
	if err != nil {
		log.Error(err)
		return
	}
	err = oauthSession.Save(r, w)
	if err != nil {
		log.Error(err)
		return
	}
	savedusername := oauthSession.Values["username"]
	if savedusername != nil {
		username, _ = savedusername.(string)
	}
	return
}
101381
func (m *GoogleOAuth2Method) GetUserCredentials(c context.Context, r *http.Request) (*oauth2.Token, error) {
	accessToken, err := accessTokenFromHeader(r.Header.Get("Authorization"))
	if err != nil {
		return nil, err
	}
	return &oauth2.Token{
		AccessToken: accessToken,
		TokenType:   "Bearer",
	}, nil
}
426177
func (api *Client) GetUserByEmail(email string) (*User, error) {
	return api.GetUserByEmailContext(context.Background(), email)
}
1112064
func (mgr *IdentityManager) GetUser(username string) (*User, error) { //nolint

	u, err := mgr.loadUserFromStore(username)
	if err != nil {
		if err != msp.ErrUserNotFound {
			return nil, errors.WithMessage(err, "loading user from store failed")
		}
		// Not found, continue
	}

	if u == nil {
		certBytes := mgr.getEmbeddedCertBytes(username)
		if certBytes == nil {
			certBytes, err = mgr.getCertBytesFromCertStore(username)
			if err != nil && err != msp.ErrUserNotFound {
				return nil, errors.WithMessage(err, "fetching cert from store failed")
			}
		}
		if certBytes == nil {
			return nil, msp.ErrUserNotFound
		}
		privateKey, err := mgr.getEmbeddedPrivateKey(username)
		if err != nil {
			return nil, errors.WithMessage(err, "fetching embedded private key failed")
		}
		if privateKey == nil {
			privateKey, err = mgr.getPrivateKeyFromCert(username, certBytes)
			if err != nil {
				return nil, errors.WithMessage(err, "getting private key from cert failed")
			}
		}
		if privateKey == nil {
			return nil, fmt.Errorf("unable to find private key for user [%s]", username)
		}
		mspID, ok := comm.MSPID(mgr.config, mgr.orgName)
		if !ok {
			return nil, errors.New("MSP ID config read failed")
		}
		u = &User{
			id:                    username,
			mspID:                 mspID,
			enrollmentCertificate: certBytes,
			privateKey:            privateKey,
		}
	}
	return u, nil
}