Generates the credential token and returns it.

@return string credentialToken
350059
public function getToken() : string {
        if (($this->token === null) || ($this->token->isExpired())) {
            $jwtBuilder = new Builder();
            $jwtBuilder->set('iss', $this->handlerPublicKey);
            $jwtBuilder->set('sub', $this->credentialPublicKey);

            $this->token = $jwtBuilder
                ->sign(new Sha256(), $this->handlerPrivateKey)
                ->getToken();
        }

        return (string) $this->token;
    }
594496
public function getTokenName()
    {
        $session = \PHPSession::singleton();

        if ($session->hasAttribute(TokenStore::TOKEN_NAME)) {
            $name = $session->getAttribute(TokenStore::TOKEN_NAME);
        } else {
            $name = 'tao_' . substr(md5(microtime()), rand(0, 25), 7);
            $session->setAttribute(TokenStore::TOKEN_NAME, $name);
        }

        return $name;
    }
118853
protected function getTokenByClientCredentialsGrant()
    {
        $token = $this->getAuthorizationServer()->getAccessToken('client_credentials', [
            'scope' => $this->config['client_credentials']['scope'],
        ]);

        $this->getFrameworkBridge()->persistClientToken(
            $this->config['client_credentials']['client_id'],
            $token->getToken(),
            $token->getExpires(),
            $token->getValues()['role']
        );

        return $token;
    }
1005935
public function generateToken()
    {
        // Generate token from unique input
        $generator = new RandomNumberGenerator();
        $time      = microtime(true);
        $salt      = $generator->generate();

        return sha1($time.$salt);
    }
99326
public function get(): string
    {
        if (!$this->storage->exists('csrfToken')) {
            $this->generate();
        }

        return $this->storage->get('csrfToken');
    }
150775
public function getToken()
    {
        if (Cache::has(self::CACHE_NAME)) {
            return Cache::get(self::CACHE_NAME);
        } else {
            $url    = $this->url."token";
            $option = [
                'grant_type'    => 'client_credentials',
                'client_id'     => $this->client_id,
                'client_secret' => $this->client_secret,
            ];
            $return = Http::postCurl($url, $option);
            Cache::put(self::CACHE_NAME, $return['access_token'], (int) ($return['expires_in'] / 60));

            return $return['access_token'];

        }
    }
858859
public function getCredentials()
    {
        $result = $this->getSettingsByGroup('credentials');
        // No separate key for now.
        $result[Tag::EmailOnWarning] = $result[Tag::EmailOnError];
        return $result;
    }
104890
public function getToken(): string
    {
        return $this->cache->remember($this->tokenKey, $this->tokenTTL, function () {
            return $this->fetchToken();
        });
    }
1103058
public function generateToken()
    {
        $token = Mage::helper('core')->getRandomString(16);
        $this->addCookie(self::COOKIE_TOKEN, $token);
        $this->addCookie(self::COOKIE_TOKEN_CHECKSUM, $this->getChecksum(array('token' => $token)));
        return $this;
    }
592851
public function getTokenString()
    {
        $cacheId = $this->getCacheId();

        if ($this->cache && $data = $this->cache->fetch($cacheId)) {
            return $data['access_token'];
        }

        $response = $this->getTokenResponse();

        if ($this->cache) {
            $this->cache->save($cacheId, $response, $response['expires_in']);
        }

        return $response['access_token'];
    }
601925
protected function createToken()
    {
        $token = $this->getToken()->createApplicationToken(
            $this->connect->getSaml()->getMetadata()->getServiceProvider()->getEntityID(),
            $this->connect->getSaml()->getPrivateKey()
        );
        return $token['token'];
    }
861312
public function authenticate()
	{
		// Already got some credentials stored?
		if ($this->token)
		{
			$response = $this->verifyCredentials();

			if ($response)
			{
				return $this->token;
			}
			else
			{
				$this->token = null;
			}
		}

		// Check for callback.
		if (strcmp($this->version, '1.0a') === 0)
		{
			$verifier = $this->input->get('oauth_verifier');
		}
		else
		{
			$verifier = $this->input->get('oauth_token');
		}

		if (empty($verifier))
		{
			// Generate a request token.
			$this->_generateRequestToken();

			// Authenticate the user and authorise the app.
			$this->_authorise();
		}

		// Callback
		else
		{
			$session = $this->application->getSession();

			// Get token form session.
			$this->token = array('key' => $session->get('key', null, 'oauth_token'), 'secret' => $session->get('secret', null, 'oauth_token'));

			// Verify the returned request token.
			if (strcmp($this->token['key'], $this->input->get('oauth_token')) !== 0)
			{
				throw new \DomainException('Bad session!');
			}

			// Set token verifier for 1.0a.
			if (strcmp($this->version, '1.0a') === 0)
			{
				$this->token['verifier'] = $this->input->get('oauth_verifier');
			}

			// Generate access token.
			$this->_generateAccessToken();

			// Return the access token.
			return $this->token;
		}
	}
237106
public function generateToken() {
		if( !isset($_SESSION[self::SESSION_KEY][$this->name]) ) {
			$_SESSION[self::SESSION_KEY][$this->name]	= array();
		}
		$TOKEN_SESSION = &$_SESSION[self::SESSION_KEY][$this->name];
		do {
			$token = generatePassword(static::$TOKEN_LENGTH);
		} while( isset($TOKEN_SESSION[$token]) );
		if( count($TOKEN_SESSION) >= $this->maxToken ) {
			array_shift($TOKEN_SESSION);
		}
		$TOKEN_SESSION[$token]	= 0;
		return $token;
	}
105583
public function getCsrfToken() {
		if (!isset($_SESSION[$this->csrfTokenSessionKey])) {
			$this->generateCsrfToken();
		}
		return $_SESSION[$this->csrfTokenSessionKey];
	}
1272238
protected function generateToken() {
		$session = $this->getSession();
		if($session->has('_csrf_token'))
			return $session['_csrf_token'];
		else {
			$token = \Asgard\Common\Tools::randstr();
			return $session['_csrf_token'] = $token;
		}
	}
632681
public function getTokenString()
    {
        $signinInput = $this->generateSigninInput();

        return sprintf('%s.%s', $signinInput, $this->encoder->encode($this->getSignature()));
    }
722996
protected function generateToken()
	{
		if (function_exists('openssl_random_pseudo_bytes'))
		{
			$token = base64_encode( openssl_random_pseudo_bytes(32));
		}
		elseif (function_exists("hash_algos") and in_array("sha256",hash_algos()))
		{
			// generate a random token using sha256
			$token = hash("sha256",mt_rand(0,mt_getrandmax()));
		}
		else
		{
			// use a randomizer algorithm if we don't have hash-sha256 available
			$token='';
			for ($i=0;$i<64;++$i)
			{
				$r=mt_rand(0,35);
				$token .= $r<26 ? chr(ord('a')+$r) : chr(ord('0')+$r-26);
			}
		}

		return $token;
	}