Get GitHub authentication user.

@throws RuntimeException

@return string
480221
public function getUser()
    {
        $info = $this
            ->gitHubUserAuth()
            ->getStoreData();

        $user = isset($info['user'])
            ? $info['user']
            : getenv('PROJECTX_GITHUB_USER') ?: null;

        if (!isset($user)) {
            throw new \RuntimeException(
                "GitHub authentication user is required. \r\n\n " .
                '[info] Run vendor/bin/project-x github::auth to get started.'
            );
        }

        return $user;
    }
943768
public function getUser(): ?string
    {
        return $this->encodeComponent($this->user, self::NO_ENCODING, self::REGEXP_USERINFO_ENCODING);
    }
1354554
private function user($access_token) {
		$user = $this->serverGet('https://api.github.com/user', array('access_token' => $access_token), null, $headers);

		if (!empty($user)) {
			return $this->recursiveGetObjectVars(json_decode($user));
		}
		else {
			$error = array(
				'code' => 'userinfo_error',
				'message' => 'Failed when attempting to query GitHub v3 API for user information',
				'raw' => array(
					'response' => $user,
					'headers' => $headers
				)
			);

			$this->errorCallback($error);
		}
	}
928707
public function getName()
    {
        if (!array_key_exists(self::NAME, $this->passwd)) {
            throw new \Exception('Could not get user name from passwd.');
        }
        return $this->passwd[self::NAME];
    }
214869
def _get_github(self):
        
        from github import Github
        vms("Querying github with user '{}'.".format(self.username))
        g = Github(self.username, self.apikey)
        self._user = g.get_user()
        if self._user is None:
            raise ValueError("Can't authenticate to github with '{}'.".format(self.username))
        #The github user authenticating always has to be specified; however the user
        #may not be able to see the repo, even if it has access to it. We may need
        #to check the organization repos.
        if self.organization is not None:
            self._org = g.get_organization(self.organization)
            vms("Found github organization '{}'.".format(self._org.name), 2)

            #Next we need to find this repository in the lists available to both
            #the user *and* the organization. If they specified an organization, then we
            #should check that first/exclusively.
            for repo in self._org.get_repos():
                if repo.full_name.lower() == self.name.lower():
                    self._repo = repo
                    vms("Found organization repository '{}'.".format(self._repo.full_name), 2)
                    break
        else:
            for repo in self._user.get_repos():
                if repo.full_name.lower() == self.name.lower():
                    self._repo = repo
                    vms("Found user repository '{}'.".format(self._repo.full_name), 2)
                    break
1269331
protected function doLogin()
    {
        $connection = $this->connection;
        $user = $this->getParam('user');
        $password = $this->getParam('pass');

        return $this->retry(function () use ($connection, $user, $password) {
            $res = @ftp_login($connection, $user, $password);

            if (!$res) {
                throw new \RuntimeException("Login failed for user: ".$user);
            }
        });
    }
1249764
public function getCurrentUser()
    {
        if ($token = $this->tokenStorage->getToken()) {
            if (($user = $token->getUser()) && is_object($user)) {
                return $user;
            }
        }

        throw new \Exception('Authorization needed', ErrorCode::CODE_UNAUTHORIZED);
    }
985216
public function getAuthenticatedUser()
	{
		// Build the request path.
		$path = '/user';

		// Send the request.
		return $this->processResponse(
			$this->client->get($this->fetchUrl($path))
		);
	}
1287648
public function getRequestUser()
    {
        if ($this->requestUser === null) {
            $token = $this->getRequestApiToken();
            if ($token === '') {
                $this->requestUser = 'no-token';
            } else {
                $ip = $this->app->make('ip');
                if ($ip->isBanned()) {
                    $this->requestUser = 'banned';
                } else {
                    $requestUser = null;
                    $list = new UserList();
                    $list->disableAutomaticSorting();
                    $list->filterByAttribute('api_token', $token);
                    $ids = $list->getResultIDs();
                    if (!empty($ids)) {
                        $u = \User::getByUserID($ids[0]);
                        if ($u->isRegistered()) {
                            $requestUser = $u;
                        }
                    }
                    if ($requestUser === null) {
                        $this->requestUser == 'invalid-token';
                        $ip->logSignupRequest();
                        if ($ip->signupRequestThreshholdReached()) {
                            $ip->createIPBan();
                        }
                    } else {
                        $this->requestUser = $requestUser;
                    }
                }
            }
        }
        if ($this->requestUser === 'no-token') {
            throw AccessDeniedException::create(t('API Access Token required'));
        }
        if ($this->requestUser === 'banned') {
            throw AccessDeniedException::create($this->app->make('ip')->getErrorMessage());
        }
        if ($this->requestUser === 'invalid-token') {
            throw AccessDeniedException::create(t('Bad API Access Token'));
        }

        return $this->requestUser;
    }
1213303
public function getUser($token)
    {
        $payload = $this->getPayload($token);

        if (empty($payload[JWSTokenService::USER_ID_KEY])) {
            throw new ProgrammerException("No user_id in token payload", ProgrammerException::AUTH_TOKEN_NO_USER_ID);
        }

        $userId = $payload[JWSTokenService::USER_ID_KEY];

        $user =  $this->userService->findUserById($userId);

        if (empty($user)) {
            throw new ProgrammerException(
                "Unknown user id in token, " . $userId,
                ProgrammerException::AUTH_TOKEN_NO_USER_WITH_ID_FOUND
            );
        }

        return $user;
    }
338769
public function getAuthUserId()
    {
        $user_id = null;
        $user = $this->getAuthUser();
        if ($user) {
            $user_id = $user->user_id;
        }
        return $user_id;
    }
1147027
public function getUser()
    {
        /** @var AbstractAdmin $admin */
        $admin = $this;

        $container = $admin->getContainer();

        if (!$container->has('security.token_storage')) {
            return null;
        }

        $tokenStorage = $container->get('security.token_storage');

        if (null === $token = $tokenStorage->getToken()) {
            return null;
        }

        if (!\is_object($user = $token->getUser())) {
            // e.g. anonymous authentication
            return null;
        }

        return $user;
    }
1171785
public function get()
    {
        $customer = null;
        $user = null;

        if (true === $this->securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
            // user is authenticated
            $user = $this->securityContext->getToken()->getUser();

            if (!$user instanceof UserInterface) {
                throw new \RuntimeException('User must be an instance of Symfony\Component\Security\Core\User\UserInterface');
            }

            $customer = $this->customerManager->findOneBy([
                'user' => $user->getId(),
            ]);
        }

        if (!$customer) {
            $basket = $this->getBasket();

            if ($basket && $basket->getCustomer()) {
                $customer = $basket->getCustomer();
            }
        }

        if (!$customer) {
            $customer = $this->customerManager->create();
        }

        if (!$customer->getLocale()) {
            $customer->setLocale($this->locale);
        }

        if ($user && $customer) {
            $customer->setUser($user);
        }

        return $customer;
    }
1133587
public function getUser()
    {
        if (empty($this->obHelper)) {
            return null;
        }

        $sAuthFacadeClass = $this->obHelper->getAuthFacade();

        return $sAuthFacadeClass::getUser();
    }
699725
public function user()
    {
        if (! $this->hasNecessaryVerifier()) {
            throw new InvalidArgumentException('Invalid request. Missing OAuth verifier.');
        }

        $token = $this->getToken();

        $user = $this->server->getUserDetails(
            $token, $this->shouldBypassCache($token->getIdentifier(), $token->getSecret())
        );

        $instance = (new User)->setRaw($user->extra)
                ->setToken($token->getIdentifier(), $token->getSecret());

        return $instance->map([
            'id' => $user->uid,
            'nickname' => $user->nickname,
            'name' => $user->name,
            'email' => $user->email,
            'avatar' => $user->imageUrl,
        ]);
    }
388123
function getUserCredentials() {
  return new Promise((resolve) => {
    print(clc.bold('Sign in to authorize this app to find open pull-requests'), true);
    gitUser.email((err, email) => {
      prompt.message = '';
      prompt.delimiter = '';
      prompt.start();
      prompt.get({
        properties: {
          username: {
            description: 'Github username',
            default: email,
            message: 'Name must be only letters, spaces, or dashes',
            required: true
          },
          password: {
            description: 'Github password',
            hidden: true
          }
        }
      }, (err, result) => {
        resolve(result);
      });
    });
  });
}
214026
def get_user(self, login=github.GithubObject.NotSet):
        
        assert login is github.GithubObject.NotSet or isinstance(login, (str, unicode)), login
        if login is github.GithubObject.NotSet:
            return AuthenticatedUser.AuthenticatedUser(self.__requester, {}, {"url": "/user"}, completed=False)
        else:
            headers, data = self.__requester.requestJsonAndCheck(
                "GET",
                "/users/" + login
            )
            return github.NamedUser.NamedUser(self.__requester, headers, data, completed=True)