src/OAuth2/Controller/AuthorizeController.php
public function handleAuthorizeRequest(RequestInterface $request, ResponseInterface $response, $is_authorized, $user_id = null)
    {
        if (!is_bool($is_authorized)) {
            throw new InvalidArgumentException('Argument "is_authorized" must be a boolean.  This method must know if the user has granted access to the client.');
        }

        // We repeat this, because we need to re-validate. The request could be POSTed
        // by a 3rd-party (because we are not internally enforcing NONCEs, etc)
        if (!$this->validateAuthorizeRequest($request, $response)) {
            return;
        }

        // If no redirect_uri is passed in the request, use client's registered one
        if (empty($this->redirect_uri)) {
            $clientData              = $this->clientStorage->getClientDetails($this->client_id);
            $registered_redirect_uri = $clientData['redirect_uri'];
        }

        // the user declined access to the client's application
        if ($is_authorized === false) {
            $redirect_uri = $this->redirect_uri ?: $registered_redirect_uri;
            $this->setNotAuthorizedResponse($request, $response, $redirect_uri, $user_id);

            return;
        }

        // build the parameters to set in the redirect URI
        if (!$params = $this->buildAuthorizeParameters($request, $response, $user_id)) {
            return;
        }

        $authResult = $this->responseTypes[$this->response_type]->getAuthorizeResponse($params, $user_id);

        list($redirect_uri, $uri_params) = $authResult;

        if (empty($redirect_uri) && !empty($registered_redirect_uri)) {
            $redirect_uri = $registered_redirect_uri;
        }

        $uri = $this->buildUri($redirect_uri, $uri_params);

        // return redirect response
        $response->setRedirect($this->config['redirect_status_code'], $uri);
    }
public function handleAuthorizeRequest(RequestInterface $request, ResponseInterface $response, $is_authorized, $user_id = null)
    {
        if (!is_bool($is_authorized)) {
            throw new InvalidArgumentException('Argument "is_authorized" must be a boolean.  This method must know if the user has granted access to the client.');
        }

        // We repeat this, because we need to re-validate. The request could be POSTed
        // by a 3rd-party (because we are not internally enforcing NONCEs, etc)
        if (!$this->validateAuthorizeRequest($request, $response)) {
            return;
        }

        // If no redirect_uri is passed in the request, use client's registered one
        if (empty($this->redirect_uri)) {
            $clientData              = $this->clientStorage->getClientDetails($this->client_id);
            $registered_redirect_uri = $clientData['redirect_uri'];
        }

        // the user declined access to the client's application
        if ($is_authorized === false) {
            $redirect_uri = $this->redirect_uri ?: $registered_redirect_uri;
            $this->setNotAuthorizedResponse($request, $response, $redirect_uri, $user_id);

            return;
        }

        // build the parameters to set in the redirect URI
        if (!$params = $this->buildAuthorizeParameters($request, $response, $user_id)) {
            return;
        }

        $authResult = $this->responseTypes[$this->response_type]->getAuthorizeResponse($params, $user_id);

        list($redirect_uri, $uri_params) = $authResult;

        if (empty($redirect_uri) && !empty($registered_redirect_uri)) {
            $redirect_uri = $registered_redirect_uri;
        }

        $uri = $this->buildUri($redirect_uri, $uri_params);

        // return redirect response
        $response->setRedirect($this->config['redirect_status_code'], $uri);
    }
public function handleAuthorizeRequest ( RequestInterface $ request , ResponseInterface $ response , $ is_authorized , $ user_id = null ) { if ( ! is_bool ( $ is_authorized ) ) { throw new InvalidArgumentException ( 'Argument "is_authorized" must be a boolean.  This method must know if the user has granted access to the client.' ) ; } // We repeat this, because we need to re-validate. The request could be POSTed // by a 3rd-party (because we are not internally enforcing NONCEs, etc) if ( ! $ this -> validateAuthorizeRequest ( $ request , $ response ) ) { return ; } // If no redirect_uri is passed in the request, use client's registered one if ( empty ( $ this -> redirect_uri ) ) { $ clientData = $ this -> clientStorage -> getClientDetails ( $ this -> client_id ) ; $ registered_redirect_uri = $ clientData [ 'redirect_uri' ] ; } // the user declined access to the client's application if ( $ is_authorized === false ) { $ redirect_uri = $ this -> redirect_uri ? : $ registered_redirect_uri ; $ this -> setNotAuthorizedResponse ( $ request , $ response , $ redirect_uri , $ user_id ) ; return ; } // build the parameters to set in the redirect URI if ( ! $ params = $ this -> buildAuthorizeParameters ( $ request , $ response , $ user_id ) ) { return ; } $ authResult = $ this -> responseTypes [ $ this -> response_type ] -> getAuthorizeResponse ( $ params , $ user_id ) ; list ( $ redirect_uri , $ uri_params ) = $ authResult ; if ( empty ( $ redirect_uri ) && ! empty ( $ registered_redirect_uri ) ) { $ redirect_uri = $ registered_redirect_uri ; } $ uri = $ this -> buildUri ( $ redirect_uri , $ uri_params ) ; // return redirect response $ response -> setRedirect ( $ this -> config [ 'redirect_status_code' ] , $ uri ) ; }
Handle the authorization request

@param RequestInterface  $request
@param ResponseInterface $response
@param boolean           $is_authorized
@param mixed             $user_id
@return mixed|void
@throws InvalidArgumentException
Handle the authorization request