2017-06-30
@used-by getAndSaveTheRefreshToken()
@used-by token()
@param array(string => string) $key
@return array(string => mixed)
@throws DFE
16523
private function requestToken(array $key) {
		$s = $this->ss();
		// 2017-06-28
		// «Now that you've acquired an authorization code and have been granted permission by the user,
		// you can redeem the code for an access token to the desired resource,
		// by sending a POST request to the `/token` endpoint.»
		// «Use the authorization code to request an access token»:
		// https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code#use-the-authorization-code-to-request-an-access-token
		$c = df_zf_http($this->urlToken())
			->setHeaders(['accept' => 'application/json'])
			->setMethod(C::POST)
			->setParameterPost($this->pCommon() + $key + ['client_secret' => $s->clientPassword()])
		; /** @var C $c */
		/** @var array(string => mixed) $r */
		$this->validateResponse($r = df_json_decode($c->request()->getBody()));
		return $r;
	}
126855
public function getJson($key)
    {
        $signature = array();
        $signature['protected'] = self::base64Encode(Parser::encode($this->headers));
        $signature['payload']   = self::base64Encode($this->claim);
        $signature['signature'] = $this->getEncodedSignature($key);

        return Parser::encode($signature);
    }
557055
public function requestHasToken($key)
    {
        $token = $this->request->input($key, null);
        
        if($token && $token === $this->getToken($key))
        {
            return true;
        }

        return false;
    }
570608
public function getRequired(string $key)
    {
        if (!$this->has($key)) {
            throw new \InvalidArgumentException('Element ' . $key . ' does not exist');
        }

        return $this->collection[$this->keyMap[strtolower($key)]];
    }
321446
public function getData(string $key)
    {
        return ($key !== 'password' || $key !== 'salt' || $key !== 'remember_me') ? $this->data[$key] : false;
    }
148206
public function getIssueByKey($key)
    {
        if (array_key_exists($key, $this->issues) && isset($this->issues[$key])) {
            return $this->issues[$key];
        }

        return null;
    }
927282
public function getRefreshToken($tenantKey)
    {
        $tenantKey = $tenantKey == null ? $this->tenantKey : $tenantKey;
        if ($this->tenantTokens[$tenantKey] == null) {
            $this->tenantTokens[$tenantKey] = array();
        }
        return isset($this->tenantTokens[$tenantKey]['refreshToken'])
            ? $this->tenantTokens[$tenantKey]['refreshToken']
            : null;
    }
1018094
public function getOldInput($key)
    {
        $this->input = $this->request->hasOldInput() !== false ? $this->request->oldInput() : array();

        // Input that is flashed to the flash can be easily retrieved by the
        // developer, making repopulating old forms and the like much more
        // convenient, since the request's previous input is available.
        return array_get($this->input, $this->transformKey($key), null);
    }
574970
public function loadToken($key)
    {
        $token = $this->db
            ->select('ucms_user_token', 'ut')
            ->fields('ut')
            ->condition('token', $key)
            ->range(0, 1)
            ->execute()
            ->fetchObject('MakinaCorpus\\Ucms\\User\\Token');

        if (!$token) {
            return null;
        }

        $token->expiration_date = new \DateTime($token->expiration_date);
        return $token;
    }
931692
public function getLastToken($type, $key = 'type')
    {
        return $this->token()->orderBy('tokens.created_at', 'desc')->where($key, $type)->first();
    }
1129471
public function get(string $key)
    {
        if ($this->replacedPayload) {
            if (! \array_key_exists($key, $this->payload)) {
                throw new \BadMethodCallException("Message payload of {$this->messageName()} does not contain a key $key.");
            }

            return $this->payload[$key];
        }

        if ($key !== self::MESSAGE) {
            throw new \BadMethodCallException(__CLASS__ . ' payload only contains a ' . self::MESSAGE . ' key.');
        }

        return $this->message;
    }
1120058
public function expiration($key)
	{
		if (isset($this->data[static::EXPIRE_DATA_KEY][$key]))
		{
			$expiration = array(
				$this->data[static::EXPIRE_DATA_KEY][$key][0] == EXPIRE_ON_REQUEST ? 'EXPIRE_ON_REQUEST' : 'EXPIRE_ON_GET',
				$this->data[static::EXPIRE_DATA_KEY][$key][1] == static::EXPIRE_STATE_NEW ? 'STATE_NEW' : ($this->data[static::EXPIRE_DATA_KEY][$key][1] == static::EXPIRE_STATE_LOADED ? 'STATE_LOADED' : 'STATE_EXPIRED'),
			);
			return $expiration;
		}

		return false;
	}
154245
protected function getConditionsFromKey($key)
    {
        if (is_int($key) || ctype_digit($key)) {
            return array(self::MATCH_USER_ID => $key);
        }
        if (strpos($key, '@') !== false) {
            return array(self::MATCH_USER_EMAIL => $key);
        }
        return array(self::MATCH_USER_LOGIN => $key);
    }
1373415
public function retrieveToken($key)
  {
    $location = $this->_createFileName($key);
    if(file_exists($location))
    {
      return file_get_contents($location);
    }
    return null;
  }
1330449
public function getAuthKeyVar($key)
    {
        if (!isset($this->authKeyMap[$key])) {
            $msg = 'Invalid Auth key requested: ' . $key;
            throw new ApiException($msg);
        }

        $property = $this->authKeyMap[$key];
        return $this->$property;
    }
1064484
public function get($key)
    {
        if (! isset($this->storage[$key])) {
            return;
        }

        $item = $this->storage[$key];

        $expiresAt = $item['expiresAt'] ?? 0;

        if ($expiresAt !== 0 && $this->currentTime() > $expiresAt) {
            $this->forget($key);

            return;
        }

        return $item['value'];
    }
822397
public function getAsArray($key)
    {
        $rawValue = $this->get($key);
        if (!is_array($rawValue)) {
            $rawValue = [];
        }

        return $rawValue;
    }