Git Product home page Git Product logo

oauth2-server-lumen's Introduction

oauth2-server-lumen

A Lumen bridge for lucadegasperi/oauth2-server-laravel.

Guide

I have written an extensive blog post on it's use here.

Building a web app with Lumen web API and OAuth2 authentication

Installation

Via composer

Run composer require optimus/oauth2-server-lumen 0.1.*

Register package

In your bootstrap/app.php register service providers

$app->register('LucaDegasperi\OAuth2Server\Storage\FluentStorageServiceProvider');
$app->register('Optimus\OAuth2Server\OAuth2ServerServiceProvider');

... and middleware

$app->middleware([
    'LucaDegasperi\OAuth2Server\Middleware\OAuthExceptionHandlerMiddleware'
]);

... and route middleware

$app->routeMiddleware([
    'check-authorization-params' => 'Optimus\OAuth2Server\Middleware\CheckAuthCodeRequestMiddleware',
    'csrf' => 'Laravel\Lumen\Http\Middleware\VerifyCsrfToken',
    'oauth' => 'Optimus\OAuth2Server\Middleware\OAuthMiddleware',
    'oauth-owner' => 'Optimus\OAuth2Server\Middleware\OAuthOwnerMiddleware'
]);

Copy config

Copy vendor/lucadegasperi/oauth2-server-laravel/config/oauth2.php to your own config folder (config/oauth2.php in your project root). It has to be the correct config folder as it is registered using $app->configure().

Migrate

Run php artisan migrate --path=vendor/lucadegasperi/oauth2-server-laravel/migrations

If you get an error saying the Config class can not be found, add class_alias('Illuminate\Support\Facades\Config', 'Config'); to your bootstrap/app.php file and uncomment $app->withFacades(); temporarily to import the migrations.

Usage

The package is now installed for Lumen. Usage is the same as with lucadegasperi/oauth2-server-laravel, so I suggest you read the wiki for usage.

oauth2-server-lumen's People

Contributors

esbenp avatar olavocneto avatar sorora 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  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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oauth2-server-lumen's Issues

bindShared() is now singleton()

The dependency version of lucadegasperi/oauth2-server-laravel is using $app->bindShared() which is now called $app->singleton().

The fix is to update your dependency to 5.1.1

Error Composer Require

Hi,

When I run a composer require over a project with Lumen 5.6.* I get the following error:

Problem 1
- Conclusion: don't install lucadegasperi/oauth2-server-laravel 4.0.1
- Installation request for optimus/oauth2-server-lumen ^0.1.2 -> satisfiable by optimus/oauth2-server-lumen[0.1.2].
- Conclusion: remove illuminate/config v5.6.24
- Installation request for symfony/http-foundation (locked at v4.1.0) -> satisfiable by symfony/http-foundation[v4.1.0].
- Conclusion: don't install illuminate/config v5.6.24
- optimus/oauth2-server-lumen 0.1.2 requires lucadegasperi/oauth2-server-laravel ~4.0 -> satisfiable by lucadegasperi/oauth2-server-laravel[4.0.0, 4.0.1, 4.0.2, 4.0.x-dev].
- lucadegasperi/oauth2-server-laravel 4.0.0 requires illuminate/config 5.0.* -> satisfiable by illuminate/config[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4].
- lucadegasperi/oauth2-server-laravel 4.0.2 requires illuminate/config 5.0.|5.1. -> satisfiable by illuminate/config[5.0.x-dev, 5.1.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8].
- lucadegasperi/oauth2-server-laravel 4.0.x-dev requires illuminate/config 5.0.|5.1. -> satisfiable by illuminate/config[5.0.x-dev, 5.1.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8].
- Can only install one of: illuminate/config[5.0.x-dev, v5.6.24].
- Can only install one of: illuminate/config[5.1.x-dev, v5.6.24].
- Can only install one of: illuminate/config[v5.0.0, v5.6.24].
- Can only install one of: illuminate/config[v5.0.22, v5.6.24].
- Can only install one of: illuminate/config[v5.0.25, v5.6.24].
- Can only install one of: illuminate/config[v5.0.26, v5.6.24].
- Can only install one of: illuminate/config[v5.0.28, v5.6.24].
- Can only install one of: illuminate/config[v5.0.33, v5.6.24].
- Can only install one of: illuminate/config[v5.0.4, v5.6.24].
- Can only install one of: illuminate/config[v5.1.1, v5.6.24].
- Can only install one of: illuminate/config[v5.1.13, v5.6.24].
- Can only install one of: illuminate/config[v5.1.16, v5.6.24].
- Can only install one of: illuminate/config[v5.1.2, v5.6.24].
- Can only install one of: illuminate/config[v5.1.20, v5.6.24].
- Can only install one of: illuminate/config[v5.1.22, v5.6.24].
- Can only install one of: illuminate/config[v5.1.25, v5.6.24].
- Can only install one of: illuminate/config[v5.1.28, v5.6.24].
- Can only install one of: illuminate/config[v5.1.30, v5.6.24].
- Can only install one of: illuminate/config[v5.1.31, v5.6.24].
- Can only install one of: illuminate/config[v5.1.41, v5.6.24].
- Can only install one of: illuminate/config[v5.1.6, v5.6.24].
- Can only install one of: illuminate/config[v5.1.8, v5.6.24].
- Installation request for illuminate/config (locked at v5.6.24) -> satisfiable by illuminate/config[v5.6.24].

Scopes in middleware declaration ignored

Hi,

I noticed that the scopes, passed in the routes middleware declaration, are not being parsed / passed on to the filter function.

I found a fix by adding the request, next closure and the scope parameter to the parent::filter function.
I have created a pull request so you can view the difference and merge if ok.

Kind regards,

Erik aka 4levels

Double encrypted token in Proxy class

Hi,

when testing the refresh-token call I noticed that the Proxy class encrypts the token twice before storing it in the cookie. This seems to fail. When I adjust this, the refresh token call seems to work as intended.

in Proxy.php I commented line 50

48            $crypt  = app()->make('encrypter');
49
50            // $encryptedToken = $crypt->encrypt($response->refresh_token);
51
52            // Set the refresh token as an encrypted HttpOnly cookie
53            $cookie->queue('refreshToken',
54                $crypt->encrypt($response->refresh_token),

This library appears to be no longer necessary

As per the lucadegasperi/oauth2-server-laravel project (which this project is supposed to wrap), Lumen is now supported:

Lumen setup notes for lucadegasperi/oauth2-server-laravel

I no longer see a reason for this library to be used. Please correct me if I am mistaken.

Note: I have successfully used lucadegasperi/oauth2-server-laravel directly in my Lumen 5.2 project without the need for this one. Everything's working just fine.

I was prompted to do this due to this library's non-support of Lumen 5.2.

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.