mirror of
https://github.com/symfony/recipes-contrib.git
synced 2026-09-11 15:16:55 +03:00
Add recipe for FOSOAuthServerBundle
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# Read the documentation: https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/blob/master/Resources/doc/index.md#step-5-configure-fosoauthserverbundle
|
||||
fos_oauth_server:
|
||||
db_driver: orm
|
||||
|
||||
client_class: App\Entity\Client
|
||||
access_token_class: App\Entity\AccessToken
|
||||
refresh_token_class: App\Entity\RefreshToken
|
||||
auth_code_class: App\Entity\AuthCode
|
||||
@@ -0,0 +1,5 @@
|
||||
fos_oauth_server_token:
|
||||
resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml"
|
||||
|
||||
fos_oauth_server_authorize:
|
||||
resource: "@FOSOAuthServerBundle/Resources/config/routing/authorize.xml"
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"bundles": {
|
||||
"FOS\\OAuthServerBundle\\FOSOAuthServerBundle": ["all"]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"config/": "%CONFIG_DIR%/",
|
||||
"src/": "%SRC_DIR%/"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class AccessToken extends BaseAccessToken
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Client")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\User")
|
||||
* @ORM\JoinColumn(onDelete="CASCADE")
|
||||
*/
|
||||
protected $user;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class AuthCode extends BaseAuthCode
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Client")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\User")
|
||||
* @ORM\JoinColumn(onDelete="CASCADE")
|
||||
*/
|
||||
protected $user;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use FOS\OAuthServerBundle\Entity\Client as BaseClient;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class Client extends BaseClient
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class RefreshToken extends BaseRefreshToken
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Client")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\User")
|
||||
* @ORM\JoinColumn(onDelete="CASCADE")
|
||||
*/
|
||||
protected $user;
|
||||
}
|
||||
Reference in New Issue
Block a user