mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-01-03 10:41:51 +05:30
Removed unused code
This commit is contained in:
parent
a9313e76d4
commit
f9c0cb08e0
@ -1,14 +0,0 @@
|
|||||||
#!/bin/env php
|
|
||||||
<?php
|
|
||||||
|
|
||||||
require(__DIR__.'/../vendor/autoload.php');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$key = Crypto::CreateNewRandomKey();
|
|
||||||
echo sprintf('Created a new crypto key: %s', bin2hex($key)), PHP_EOL;
|
|
||||||
exit(0);
|
|
||||||
} catch (CryptoTestFailedException $ex) {
|
|
||||||
exit('Cannot safely create a key');
|
|
||||||
} catch (CannotPerformOperationException $ex) {
|
|
||||||
exit('Cannot safely create a key');
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use League\OAuth2\Server\Exception\OAuthException;
|
|
||||||
use League\OAuth2\Server\Server;
|
|
||||||
use League\OAuth2\Server\TokenTypes\JsonWebTokenType;
|
|
||||||
use OAuth2ServerExamples\Repositories\AccessTokenRepository;
|
|
||||||
use OAuth2ServerExamples\Repositories\ClientRepository;
|
|
||||||
use OAuth2ServerExamples\Repositories\ScopeRepository;
|
|
||||||
use OAuth2ServerExamples\Repositories\UserRepository;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
|
|
||||||
include(__DIR__ . '/../vendor/autoload.php');
|
|
||||||
|
|
||||||
// Setup the authorization server
|
|
||||||
$server = new Server();
|
|
||||||
$server->addRepository(new ClientRepository());
|
|
||||||
$server->addRepository(new ScopeRepository());
|
|
||||||
$server->addRepository(new AccessTokenRepository());
|
|
||||||
$server->addRepository(new UserRepository());
|
|
||||||
|
|
||||||
// Enable the password grant, respond with JWTs
|
|
||||||
$server->enableGrantType('PasswordGrant', new JsonWebTokenType());
|
|
||||||
|
|
||||||
// Setup JWT params
|
|
||||||
JsonWebTokenType::setIssuer('http://example.com/');
|
|
||||||
JsonWebTokenType::setAudience('http://myawesomeapp.com/');
|
|
||||||
JsonWebTokenType::setEncryptionKey('foobar123');
|
|
||||||
|
|
||||||
// Setup app + routing
|
|
||||||
$application = new \Proton\Application();
|
|
||||||
$application->post('/access_token', function (Request $request) use ($server) {
|
|
||||||
try {
|
|
||||||
return $server->getAccessTokenResponse($request);
|
|
||||||
} catch (OAuthException $e) {
|
|
||||||
return $e->generateHttpResponse();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Run the app
|
|
||||||
$application->run();
|
|
Loading…
Reference in New Issue
Block a user