/** * {@inheritdoc} */ public function grantAuthorization(Authorization $authorization) { $code = $this->getAuthCodeManager()->createAuthCode($authorization->getClient(), $authorization->getEndUser(), $authorization->getQueryParams(), $authorization->getRedirectUri(), $authorization->getScope(), $authorization->getIssueRefreshToken()); $params = ['code' => $code->getToken()]; if (null !== $authorization->getState()) { $params['state'] = $authorization->getState(); } return $params; }
/** * @param \OAuth2\Endpoint\Authorization $authorization * * @throws \OAuth2\Exception\BaseExceptionInterface */ protected function checkRedirectUriIfRequired(Authorization $authorization) { //If the redirect URI is not set and the configuration requires it, throws an exception if (true === $this->getConfiguration()->get('enforce_redirect_uri', false) && null === $authorization->getRedirectUri()) { throw $this->getExceptionManager()->getException(ExceptionManagerInterface::BAD_REQUEST, ExceptionManagerInterface::INVALID_REQUEST, 'The "redirect_uri" parameter is mandatory'); } }