Skip to content

Instantly share code, notes, and snippets.

@jeffsrepoaccount
Last active September 6, 2015 12:17
Show Gist options
  • Save jeffsrepoaccount/bd395ab49972bd884071 to your computer and use it in GitHub Desktop.
Save jeffsrepoaccount/bd395ab49972bd884071 to your computer and use it in GitHub Desktop.
Service Provider for Resource Server
<?php namespace App\Oauth2;
use Illuminate\Support\ServiceProvider;
use League\OAuth2\Server\ResourceServer;
class Oauth2ServiceProvider extends ServiceProvider
{
/**
* Bootstrap application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Registers a binding for the Resource Server.
*
* @return void
*/
public function register()
{
//
$app = $this->app;
$app->bind('League\OAuth2\Server\ResourceServer', function() use($app) {
$server = new ResourceServer(
$app->make('App\Oauth2\Storage\FluentSession'),
$app->make('App\Oauth2\Storage\FluentAccessToken'),
$app->make('App\Oauth2\Storage\FluentClient'),
$app->make('App\Oauth2\Storage\FluentScope')
);
return $server;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment