chore: create the class OAuth
This commit is contained in:
parent
aa39cc7361
commit
d01a0778b8
2 changed files with 36 additions and 1 deletions
35
src/OAuth.php
Normal file
35
src/OAuth.php
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace FoskyM\OAuthCenter;
|
||||||
|
|
||||||
|
use OAuth2\Server;
|
||||||
|
use OAuth2\Response;
|
||||||
|
use OAuth2\Request;
|
||||||
|
|
||||||
|
use OAuth2\GrantType\ClientCredentials;
|
||||||
|
use OAuth2\GrantType\AuthorizationCode;
|
||||||
|
use OAuth2\GrantType\UserCredentials;
|
||||||
|
use OAuth2\GrantType\RefreshToken;
|
||||||
|
class OAuth
|
||||||
|
{
|
||||||
|
public function response(): Response
|
||||||
|
{
|
||||||
|
return new Response;
|
||||||
|
}
|
||||||
|
public function request(): Request
|
||||||
|
{
|
||||||
|
return new Request;
|
||||||
|
}
|
||||||
|
public function server(): Server
|
||||||
|
{
|
||||||
|
$storage = new Storage;
|
||||||
|
$server = new Server($storage, array(
|
||||||
|
'allow_implicit' => true,
|
||||||
|
));
|
||||||
|
$server->addGrantType(new AuthorizationCode($storage));
|
||||||
|
$server->addGrantType(new ClientCredentials($storage));
|
||||||
|
$server->addGrantType(new UserCredentials($storage));
|
||||||
|
$server->addGrantType(new RefreshToken($storage));
|
||||||
|
return $server;
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ use OAuth2\Storage\RefreshTokenInterface;
|
||||||
use OAuth2\Storage\ScopeInterface;
|
use OAuth2\Storage\ScopeInterface;
|
||||||
use OAuth2\Storage\UserCredentialsInterface;
|
use OAuth2\Storage\UserCredentialsInterface;
|
||||||
|
|
||||||
abstract class Storage implements
|
class Storage implements
|
||||||
AuthorizationCodeInterface,
|
AuthorizationCodeInterface,
|
||||||
AccessTokenInterface,
|
AccessTokenInterface,
|
||||||
ClientCredentialsInterface,
|
ClientCredentialsInterface,
|
||||||
|
|
Loading…
Reference in a new issue