Giter VIP home page Giter VIP logo

symfony4-oauth2-server-league's People

Contributors

jeffreyverreckt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

symfony4-oauth2-server-league's Issues

error on composer install

I wanted to check this, unfortunately I get this on composer install - I was not sure what to edit in services.yaml - the source of the problem seems to be a simply case typo, but where to change that?

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 54 installs, 0 updates, 0 removals
  - Installing ocramius/package-versions (1.3.0): Loading from cache
  - Installing symfony/flex (v1.1.1): Loading from cache
  - Installing beberlei/assert (v3.0.1): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.9.0): Loading from cache
  - Installing doctrine/lexer (v1.0.1): Loading from cache
  - Installing doctrine/annotations (v1.6.0): Loading from cache
  - Installing doctrine/reflection (v1.0.0): Loading from cache
  - Installing doctrine/event-manager (v1.0.0): Loading from cache
  - Installing doctrine/collections (v1.5.0): Loading from cache
  - Installing doctrine/cache (v1.8.0): Loading from cache
  - Installing doctrine/persistence (v1.0.1): Loading from cache
  - Installing doctrine/inflector (v1.3.0): Loading from cache
  - Installing doctrine/common (v2.9.0): Loading from cache
  - Installing symfony/doctrine-bridge (v4.1.6): Loading from cache
  - Installing doctrine/doctrine-cache-bundle (1.3.3): Loading from cache
  - Installing doctrine/instantiator (1.1.0): Loading from cache
  - Installing symfony/console (v4.1.6): Loading from cache
  - Installing zendframework/zend-eventmanager (3.2.1): Loading from cache
  - Installing zendframework/zend-code (3.3.1): Loading from cache
  - Installing ocramius/proxy-manager (2.2.2): Loading from cache
  - Installing doctrine/dbal (v2.8.0): Loading from cache
  - Installing doctrine/migrations (v1.8.1): Loading from cache
  - Installing jdorn/sql-formatter (v1.2.17): Loading from cache
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing league/event (2.1.2): Loading from cache
  - Installing lcobucci/jwt (3.2.4): Loading from cache
  - Installing defuse/php-encryption (v2.2.1): Loading from cache
  - Installing league/oauth2-server (7.2.0): Loading from cache
  - Installing psr/cache (1.0.1): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing ramsey/uuid (3.8.0): Loading from cache
  - Installing psr/log (1.0.2): Loading from cache
  - Installing symfony/debug (v4.1.6): Loading from cache
  - Installing symfony/routing (v4.1.6): Loading from cache
  - Installing symfony/http-foundation (v4.1.6): Loading from cache
  - Installing symfony/event-dispatcher (v4.1.6): Loading from cache
  - Installing symfony/http-kernel (v4.1.6): Loading from cache
  - Installing symfony/finder (v4.1.6): Loading from cache
  - Installing symfony/filesystem (v4.1.6): Loading from cache
  - Installing symfony/dependency-injection (v4.1.6): Loading from cache
  - Installing symfony/config (v4.1.6): Loading from cache
  - Installing symfony/cache (v4.1.6): Loading from cache
  - Installing symfony/framework-bundle (v4.1.6): Loading from cache
  - Installing doctrine/orm (v2.6.2): Loading from cache
  - Installing doctrine/doctrine-bundle (1.9.1): Loading from cache
  - Installing doctrine/doctrine-migrations-bundle (v1.3.1): Loading from cache
  - Installing symfony/orm-pack (v1.0.5): Loading from cache
  - Installing symfony/inflector (v4.1.6): Loading from cache
  - Installing symfony/property-access (v4.1.6): Loading from cache
  - Installing symfony/security (v4.1.6): Loading from cache
  - Installing symfony/security-bundle (v4.1.6): Loading from cache
  - Installing symfony/yaml (v4.1.6): Loading from cache
  - Installing symfony/dotenv (v4.1.6): Loading from cache
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!  
!!  In FileLoader.php line 168:
!!                                                                                 
!!    Case mismatch between loaded and declared class names: "App\Infrastructure\  
!!    OAuth2Server\Bridge\Client" vs "App\Infrastructure\oAuth2Server\Bridge\Clie  
!!    nt" in /home/User/Test/symfony-oauth-league/config/services.yaml (which is l  
!!    oaded in resource "/home/User/Test/symfony-oauth-league/config/services.yaml  
!!    ").                                                                          
!!                                                                                 
!!  
!!  In DebugClassLoader.php line 181:
!!                                                                                 
!!    Case mismatch between loaded and declared class names: "App\Infrastructure\  
!!    OAuth2Server\Bridge\Client" vs "App\Infrastructure\oAuth2Server\Bridge\Clie  
!!    nt".                                                                         
!!                                                                                 
!!  
!!  
Script @auto-scripts was called via post-install-cmd

Following your step 1 in your Tutorial produces a different result:

User ~  Test  symfony-oauth-league  step1  $  composer require league/oauth2-server
Using version ^8.0 for league/oauth2-server
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: lcobucci/jwt[3.3.1, 3.2.4].
    - Can only install one of: lcobucci/jwt[3.3.1, 3.2.4].
    - league/oauth2-server 8.0.0 requires lcobucci/jwt ^3.3.1 -> satisfiable by lcobucci/jwt[3.3.1].
    - Installation request for league/oauth2-server ^8.0 -> satisfiable by league/oauth2-server[8.0.0].
    - Installation request for lcobucci/jwt (locked at 3.2.4) -> satisfiable by lcobucci/jwt[3.2.4].

Installation failed, reverting ./composer.json to its original content.

I would like to follow your tutorial, but the first step seems a little rough atm.

It would be great if you would like to take a look and fix that, thanks!

possible fix for symfony 5 compatible version

$psrRequest = (new DiactorosFactory)->createRequest($request);

Below is a modified version of this file from following breadcrumbs of deprecation in symfony 5, most notably replacing Diactoros with PsrHttpFactory and passing it a single instance of Psr17Factory (from nyholm/psr-17) for all argument constructors ... I'm no expert though, so I'm really guessing things.

Thank you for all your work.

`

resourceServer = $resourceServer; } /** * @return array */ public static function getSubscribedEvents(): array { return [ KernelEvents::CONTROLLER => 'onKernelController', KernelEvents::EXCEPTION => 'onKernelException' ]; } /** * @param ControllerEvent $event * @throws OAuthServerException */ public function onKernelController(ControllerEvent $event): void { $controller = $event->getController(); /* * $controller passed can be either a class or a Closure. * This is not usual in Symfony but it may happen. * If it is a class, it comes in array format */ if (!\is_array($controller)) { return; } if ($controller[0] instanceof TokenAuthenticatedController) { $request = $event->getRequest(); $psr17Factory = new Psr17Factory(); $psrRequest = (new PsrHttpFactory( $psr17Factory, $psr17Factory, $psr17Factory, $psr17Factory ))->createRequest($request); try { $psrRequest = $this->resourceServer->validateAuthenticatedRequest($psrRequest); } catch (OAuthServerException $exception) { throw $exception; } catch (\Exception $exception) { throw new OAuthServerException($exception->getMessage(), 0, 'unknown_error', Response::HTTP_INTERNAL_SERVER_ERROR); } $this->enrichSymfonyRequestWithAuthData($request, $psrRequest); } } /** * @param Request $request * @param ServerRequestInterface $psrRequest */ private function enrichSymfonyRequestWithAuthData(Request $request, ServerRequestInterface $psrRequest): void { $request = $request->request; $requestArray = $request->all(); $requestArray['oauth_user_id'] = $psrRequest->getAttribute('oauth_user_id'); $requestArray['oauth_access_token_id'] = $psrRequest->getAttribute('oauth_access_token_id'); $requestArray['oauth_client_id'] = $psrRequest->getAttribute('oauth_client_id'); $request->replace($requestArray); } /** * @param ExceptionEvent $event */ public function onKernelException(ExceptionEvent $event): void { $exception = $event->getThrowable(); if (!($exception instanceof OAuthServerException)) { return; } $response = new JsonResponse(['error' => $exception->getMessage()], $exception->getHttpStatusCode()); $event->setResponse($response); } } `

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.