2015-04-05 18:18:28 +01:00
|
|
|
<?php
|
|
|
|
|
2015-10-14 09:51:53 +01:00
|
|
|
use League\OAuth2\Server\Grant\ClientCredentialsGrant;
|
2015-04-05 18:18:28 +01:00
|
|
|
use League\OAuth2\Server\Server;
|
|
|
|
use OAuth2ServerExamples\Repositories\AccessTokenRepository;
|
|
|
|
use OAuth2ServerExamples\Repositories\ClientRepository;
|
|
|
|
use OAuth2ServerExamples\Repositories\ScopeRepository;
|
|
|
|
|
|
|
|
include(__DIR__ . '/../vendor/autoload.php');
|
|
|
|
|
|
|
|
// Setup the authorization server
|
|
|
|
$server = new Server();
|
|
|
|
|
2015-10-14 09:51:53 +01:00
|
|
|
// Init our repositories
|
|
|
|
$clientRepository = new ClientRepository();
|
|
|
|
$scopeRepository = new ScopeRepository();
|
|
|
|
$accessTokenRepository = new AccessTokenRepository();
|
2015-04-05 18:18:28 +01:00
|
|
|
|
2015-10-14 09:51:53 +01:00
|
|
|
// Enable the client credentials grant on the server
|
|
|
|
$server->enableGrantType(new ClientCredentialsGrant($clientRepository, $scopeRepository, $accessTokenRepository));
|