AuthBucket\OAuth2\ResponseType\CodeResponseTypeHandler::handle PHP Method

handle() public method

public handle ( Request $request )
$request Symfony\Component\HttpFoundation\Request
    public function handle(Request $request)
    {
        // Fetch username from authenticated token.
        $username = $this->checkUsername();
        // Fetch and check client_id.
        $clientId = $this->checkClientId($request);
        // Fetch and check redirect_uri.
        $redirectUri = $this->checkRedirectUri($request, $clientId);
        // Fetch and check state.
        $state = $this->checkState($request, $redirectUri);
        // Fetch and check scope.
        $scope = $this->checkScope($request, $clientId, $username, $redirectUri, $state);
        // Generate parameters, store to backend and set response.
        $codeManager = $this->modelManagerFactory->getModelManager('code');
        $class = $codeManager->getClassName();
        $code = new $class();
        $code->setCode(md5(openssl_random_pseudo_bytes(256)))->setClientId($clientId)->setUsername($username)->setRedirectUri($redirectUri)->setExpires(new \DateTime('+10 minutes'))->setScope((array) $scope);
        $code = $codeManager->createModel($code);
        $parameters = ['code' => $code->getCode(), 'state' => $state];
        $redirectUri = Request::create($redirectUri, 'GET', $parameters)->getUri();
        return RedirectResponse::create($redirectUri);
    }
CodeResponseTypeHandler