/** * @param AuthorizationRequestInterface $authorization * @throws InvalidArgumentException */ public function buildAuthorizationRequestUri(AuthorizationRequestAwareGrantInterface $grant) { $authorizationEndpointUri = $this->config->getAuthorizationEndpointUri(); Assertion::notNull($authorizationEndpointUri, 'Authorization endpoint uri is required to build authorization request uri.'); $request = $grant->getAuthorizationRequest(); $request->setClientId($this->config->getClientId()); $query = http_build_query($request->getQueryParameters()); return "{$authorizationEndpointUri}?{$query}"; }
/** * @return array */ public function getQueryParameters() { $clientId = $this->getClientId(); Assertion::notNull($clientId, 'clientId is required'); $params = array('response_type' => $this->getResponseType()->getValue(), 'client_id' => $clientId); if ($this->getRedirectUri() !== null) { $params['redirect_uri'] = $this->getRedirectUri()->getValue(); } if ($this->getScope() !== null) { $params['scope'] = $this->getScope()->getScopeParameter(); } if ($this->getState() !== null) { $params['state'] = $this->getState(); } return $params; }