2017 © Pedro Peláez
 

library laravel-oauth-introspect-middleware

Laravel Middleware for letting a resource owner verify a OAuth2 access tokens with a remote authorization server

image

designmynight/laravel-oauth-introspect-middleware

Laravel Middleware for letting a resource owner verify a OAuth2 access tokens with a remote authorization server

  • Tuesday, June 26, 2018
  • by StevePorter92
  • Repository
  • 5 Watchers
  • 0 Stars
  • 86 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 6 Versions
  • 310 % Grown

The README.md

Especially for a microservices architecture, authentication and authorization functions should be delegated. Protecting resources is best done by implementing the web services as a pure OAuth2 resource server, relying on token verification on a remote authorization server., (*1)

Laravel Middleware for OAuth 2.0 Token Introspection

Laravel Passport provides a full OAuth2 server implementation, yet misses optional OAuth2 functionalties as defined in OAuth 2.0 Token Introspection (RFC7662)., (*2)

The Introspection endpoint is provided by ipunkt/laravel-oauth-introspection. This package provides the middleware required for verifying an access token against a remote Introspection endpoint., (*3)

Note: To prevent token scanning attacks, the endpoint MUST also require some form of authorization to access this endpoint. The provided middleware assumes the introspection endpoint requires an OAuth2 Bearer token retrieved using a client credentials grant. Therefore, you MUST provide a valid client id and client secret., (*4)

Installation

Install the package on your resource server, (*5)

composer require designmynight/laravel-oauth-introspect-middleware

and add the Service Provider in your config/app.php, (*6)

~~~.php 'providers' => [ // [..] \DesignMyNight\Laravel\OAuth2\IntrospectMiddlewareServiceProvider::class // [..] ];, (*7)


and add the MiddleWare in your `App/Http/Kernel.php` ~~~.php protected $routeMiddleware = [ // [..] 'verifyaccesstoken' => \DesignMyNight\Laravel\OAuth2\VerifyAccessToken::class, // [..] ];

publish the configuration, (*8)

php artisan vendor:publish

Finally in your .env file, define the following properties, (*9)

~~~.properties, (*10)

Url of the authorization server

AUTHORIZATION_SERVER_URL="https://authorization.server.dom", (*11)

Client Identifier as defined in https://tools.ietf.org/html/rfc6749#section-2.2

AUTHORIZATION_SERVER_CLIENT_ID="123", (*12)

The client secret

AUTHORIZATION_SERVER_CLIENT_SECRET="abcdefg", (*13)

Endpoint for requesting the access token

AUTHORIZATION_SERVER_TOKEN_URL="${AUTHORIZATION_SERVER_URL}/oauth/token", (*14)

The OAuth2 Introspection endpoint https://tools.ietf.org/html/rfc7662

AUTHORIZATION_SERVER_INTROSPECT_URL="${AUTHORIZATION_SERVER_URL}/oauth/introspect", (*15)

Optional configuration for requesting an OAuth2 access tokens using the implicit grant flow

AUTHORIZATION_SERVER_AUTHORIZATION_URL="${AUTHORIZATION_SERVER_URL}/oauth/authorize" AUTHORIZATION_SERVER_REDIRECT_URL=https://my.machine.dom, (*16)


Now, use the middleware. ~~~.php Route::group(['middleware'=>'verifyaccesstoken:required-scope1,required-scope2'], function () { Route::get('/endpoint1', 'UserController@index'); Route::resource('/resource', 'OrderController'); });

The Versions

26/06 2018

dev-master

9999999-dev

Laravel Middleware for letting a resource owner verify a OAuth2 access tokens with a remote authorization server

  Sources   Download

MIT

The Requires

 

The Development Requires

by Steve Porter

26/06 2018

v1.0.4

1.0.4.0

Laravel Middleware for letting a resource owner verify a OAuth2 access tokens with a remote authorization server

  Sources   Download

MIT

The Requires

 

The Development Requires

by Steve Porter

05/06 2018

v1.0.3

1.0.3.0

Laravel Middleware for letting a resource owner verify a OAuth2 access tokens with a remote authorization server

  Sources   Download

MIT

The Requires

 

The Development Requires

by Steve Porter

30/05 2018

v1.0.2

1.0.2.0

Laravel Middleware for letting a resource owner verify a OAuth2 access tokens with a remote authorization server

  Sources   Download

MIT

The Requires

 

The Development Requires

by Steve Porter

18/05 2018

v1.0.1

1.0.1.0

Laravel Middleware for letting a resource owner verify a OAuth2 access tokens with a remote authorization server

  Sources   Download

MIT

The Requires

 

The Development Requires

by Steve Porter

29/01 2018

v1.0.0

1.0.0.0

Laravel Middleware for letting a resource owner verify a OAuth2 access tokens with a remote authorization server

  Sources   Download

MIT

The Requires

 

The Development Requires

by Steve Porter