get token

@param string $username
@return string|false
353795
public function get($username)
    {
        return isset($this->storage[$username]) ? $this->storage[$username] : false;
    }
1012531
public function getByUsername($username)
    {
        $filter = new IteratorFilter();
        $filter->addRelation($this->getUserDefinition()->getUsername(), Relation::EQUAL, $username);
        return $this->getUser($filter);
    }
1071540
public function get_token($name) {
         foreach(array_merge($this->blockrules, $this->tagrules) as $n => $v) {
             if($name == $n && isset($v['token'])) {
                return $v['token'] ? $v['token'] : false;
             }
         }

         return false;
     }
254649
public function findUserByUsername($username)
    {
        $qb = $this->createQueryBuilder('user')
            ->where('user.username=:username');

        $query = $qb->getQuery();
        $query->setParameter('username', $username);

        return $query->getSingleResult();
    }
24427
public function usernameToGuid($username)
    {
        $this->adldap->utilities()->validateNotNull('Username', $username);

        $this->adldap->utilities()->validateLdapIsBound();

        $filter = $this->adldap->getUserIdKey().'='.$username;

        $fields = ['objectGUID'];

        $results = $this->connection->search($this->adldap->getBaseDn(), $filter, $fields);

        $numEntries = $this->connection->countEntries($results);

        if ($numEntries > 0) {
            $entry = $this->connection->getFirstEntry($results);

            $guid = $this->connection->getValuesLen($entry, 'objectGUID');

            $strGUID = $this->adldap->utilities()->binaryToText($guid[0]);

            return $strGUID;
        }

        return false;
    }
642757
public function validateForgotPasswordToken($username, $token)
    {
        $this->username = $username;

        if ($this->getMeta()->forgotPasswordToken == $token) {
            $this->getMeta()->forgotPasswordToken = '';
            $this->getMeta()->save();

            return true;
        }

        return false;
    }
263753
private function verifyPersistToken($username, $token)
	{
		$this->debug->groupCollapsed(__METHOD__);
		$return = false;
		$vals = array(
			'username'		=> $this->db->quoteValue($username),
			'token_hash'	=> $this->db->quoteValue(sha1($token)),
		);
		$query = Str::quickTemp('SELECT * FROM `persist_tokens`
			LEFT JOIN `user_auth`
				ON `user_auth`.`username` = [::username::]
				AND `user_auth`.`userid` = `persist_tokens`.`userid`
			WHERE `token_hash` = [::token_hash::]
			ORDER BY `datetime` DESC', $vals);
		$rows = $this->db->query($query)[0];
		$this->debug->table($rows, 'rows');
		if ($rows) {
			// found token in table
			$return = $rows[0]['userid'];
			// remove the token
			$where = array();
			foreach (array('userid','datetime','token_hash') as $k) {
				$where[$k] = $rows[0][$k];
			}
			$this->db->rowMan('persist_tokens', null, $where);
			$this->log('persistTokenSuccess', $rows[0]['userid']);
		} else {
			$this->log('persistTokenFail');
		}
		$this->debug->groupEnd();
		return $return;
	}
976726
public function userLogin($username, $password)
    {
        return $this->requestHandler->sendRequestAsync('POST', 'api/v4/users/login/',
            [
                'form_params' => [
                    'username' => $username,
                    'password' => $password
                ]
            ])->then(
            function ($result) {
                $this->requestHandler->setAccessTokenCredentials($result['tokenKey'], $result['tokenSecret']);
                return $result;
            }
        );
    }
221312
public function loadUserByUsername($username)
    {
        $user = $this->session->get(AuthenticationConstants::SECURITY_TOKEN_NAME);

        if ($user instanceof User) {
            return $user;
        }

        $authenticationError = $this->session->get(Security::AUTHENTICATION_ERROR);

        if ($authenticationError instanceof AuthenticationException) {
            throw new UsernameNotFoundException($authenticationError->getMessage());
        }

        throw new UsernameNotFoundException(
            sprintf('User %s was not authenticated by API.', $username)
        );
    }
692728
public static function getUser($username = null)
	{
		if ( is_null( $username ) ) $username = self::getCurrentUsername();

		if ( self::userExists( $username ) ) {
			return self::$auth['users'][ $username ];
		}

		return null;
	}
794770
public function getForgotPasswordToken($username)
    {
        $this->username = $username;

        $token = $this->crypt()->generateUserReadableString(32);
        $this->getMeta()->forgotPasswordToken = $token;
        $this->getMeta()->save();

        return $token;
    }
42116
public function getIdByUserName($userName)
    {
        $shopId = Registry::getConfig()->getShopId();
        $userId = DatabaseProvider::getDb()
            ->getOne(
                'SELECT `OXID` FROM `oxuser` WHERE `OXUSERNAME` = ? AND `OXSHOPID` = ?',
                [
                    $userName,
                    $shopId
                ]
            );

        return $userId;
    }
1326768
public static function user($username)
    {
        $username = urlencode($username);

        return self::get(self::BASE_URL . '/json.php?username=' . $username);
    }
340491
public function getPersonalToken($username, $password)
    {
        $response = $this->client->request('POST', $this->authorization_url(),
            [
                "auth" => [ $username, $password],
                "json" => $this->authorizationsRequestJson()
            ]
        );
        $response = json_decode($response->getBody());
        $this->tokenName = $response->app->name;
        return $response->token;
    }
28022
public function getToken($token, $ip = null, $userAgent = null)
    {
        $query = $this->getTokenQuery($token, $ip, $userAgent);

        return $this->findOneWith($query);
    }
988966
public function getUserByUsername($username)
    {
        try {
            $user = $this->userRepo->loadUserByUsername($username);
        } catch (\Exception $e) {
            $user = null;
        }

        return $user;
    }
18792
protected function acquireSecurityTokenFromFederatedSTS($username, $password) {

        $response = Requests::get(str_replace('{username}', $username, self::$RealmUrlTemplate),null);
        $federatedStsUrl = $this->getFederatedAuthenticationInformation($response);

        if ($federatedStsUrl) {
          $message_id = md5(uniqid($username . '-' . time() . '-' . rand() , true));
          $data = $this->prepareSecurityFederatedTokenRequest($username, $password, $message_id, $federatedStsUrl->textContent);

          $headers = array();
          $headers['Content-Type'] = 'application/soap+xml';
          $response = Requests::post($federatedStsUrl->textContent, $headers, $data);

          $samlAssertion = $this->getSamlAssertion($response);

          if ($samlAssertion) {
            $samlAssertion_node = $samlAssertion->item(0);
            $data = $this->prepareRST2Request($samlAssertion_node);
            $response = Requests::post(self::$RST2Url, $headers, $data);
            $this->usingFederatedSTS = TRUE;

            return $response;
          }
        }

        return NULL;
    }