Retrieve the authorization state for a given service

@param string $service

@throws \OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException
@return string
430608
public function retrieveAuthorizationState($service)
    {
        $service = $this->normalizeServiceName($service);

        if ($this->hasAuthorizationState($service)) {
            $states = $this->sessionScope->get(self::SESSION_STATE);
            return $states[$service];
        }

        throw new AuthorizationStateNotFoundException('State not found in session, are you sure you stored it?');
    }
138532
protected function getService($service)
    {
        if (!isset($this->app[$service])) {
            throw new \Exception('O serviço '.$service.' não foi registrado na aplicação!');
        }

        return $this->app[$service];
    }
1213757
public function url($service)
    {
        $url = 'index.php?option=com_connect&view=login&server='.$service;

        if (AnRequest::get('get.return', 'cmd')) {
            $url .= '&return='.AnRequest::get('get.return', 'raw');
        }

        return route($url);
    }
299159
protected function getOAuthUrl($state)
    {
        $queries = [
            'appid' => $this->clientId,
            'redirect_uri' => $this->redirectUrl,
            'response_type' => 'code',
            'scope' => $this->formatScopes($this->scopes, $this->scopeSeparator),
            'agentid' => $this->agentId,
            'state' => $state,
        ];

        return sprintf('https://open.weixin.qq.com/connect/oauth2/authorize?%s#wechat_redirect', http_build_query($queries));
    }
1166411
public function hasAccessToken($service)
    {
        $service = $this->normalizeServiceName($service);

        $tokens = $this->sessionScope->get(self::SESSION_TOKEN);
        return isset($tokens[$service]);
    }
308784
public static function getToken ($token, string $service)
	{
		switch ($service)
		{
			case GeoEnum::AppleMapKit:
			case MapTiles::MapKitStandard:
			case MapTiles::MapKitMutedStandard:
			case MapTiles::MapKitSatellite:
			case MapTiles::MapKitHybrid:
				return JWT::getToken(
					trim($token['privateKey']),
					trim($token['keyId']),
					trim($token['teamId'])
				);
			default:
				return $token;
		}
	}
542694
protected function isTokenLoaded( $service ) {
        return ( array_key_exists( $service, $this->tokens ) && ( $this->tokens[$service] instanceof SecurityToken ) );
    }
466738
public function get($service)
    {
        return $this->has($service) ? $this->container->get($service) : null;
    }
910195
public function getServiceDatum($service, $key)
    {
        if (isset($this->servicesData[$service])) {
            return $this->servicesData[$service][$key];
        }

        return null;
    }
896204
public function getState($id)
	{
		if ($id === null) {
			return '';
		} else {
			return isset($this->properties_storage[$id]['state'])
				? $this->properties_storage[$id]['state']
				: '';
		}
	}
35354
public function getContainer($service = null)
    {
        return is_null($service) ? ($this->container ?: app()) : ($this->container[$service] ?: app($service));
    }
796874
public function hasAuthorizationState($service)
    {
        $service = $this->normalizeServiceName($service);

        $states = $this->sessionScope->get(self::SESSION_STATE);
        return isset($states[$service]);
    }
179033
public function resolve($service)
    {
        if (isset($this->resolved[$service])) {
            return $this->resolved[$service];
        }

        return $this->resolved[$service] = $this->getFunc($service);
    }
777513
public function hasCSRFState(string $service):bool {
		return isset($this->states[$service]) && null !== $this->states[$service];
	}
1038823
protected function getState($state = null)
	{
		if(null === $state)
		{
			if(null === $this->state)
			{
				$this->state = md5(\uniqid('', true));
			}
		}
		else
		{
			$this->state = $state;
		}
		return $this->state;
	}
512360
public function getState() {
    if (empty($this->state)) {
      $this->state = \Drupal::service('state');
    }
    return $this->state;
  }
63716
public function clearCSRFState(string $service):OAuthStorageInterface{

		if(array_key_exists($service, $_SESSION[$this->stateVar])){
			unset($_SESSION[$this->stateVar][$service]);
		}

		return $this;
	}