OAuthClient.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Base\OAuthServerBundle\Entity;
  3. use FOS\OAuthServerBundle\Entity\Client as BaseClient;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity
  7. */
  8. class OAuthClient extends BaseClient
  9. {
  10. const GRANT_TYPE_PASSWORD = 'password';
  11. const GRANT_TYPE_REFRESH_TOKEN = 'refresh_token';
  12. const GRANT_TYPE_TOKEN = 'token';
  13. const GRANT_TYPE_AUTHORIZATION_CODE = 'authorization_code';
  14. /**
  15. * @ORM\Id
  16. * @ORM\Column(type="integer")
  17. * @ORM\GeneratedValue(strategy="AUTO")
  18. */
  19. protected $id;
  20. public function __construct()
  21. {
  22. parent::__construct();
  23. }
  24. /**
  25. * @return array
  26. */
  27. public function __toString()
  28. {
  29. return strval($this->id);
  30. }
  31. /**
  32. * @return array
  33. */
  34. public static function getGrantTypesChoices()
  35. {
  36. return array(
  37. self::GRANT_TYPE_AUTHORIZATION_CODE => self::GRANT_TYPE_AUTHORIZATION_CODE,
  38. self::GRANT_TYPE_PASSWORD => self::GRANT_TYPE_PASSWORD,
  39. self::GRANT_TYPE_REFRESH_TOKEN => self::GRANT_TYPE_REFRESH_TOKEN,
  40. self::GRANT_TYPE_TOKEN => self::GRANT_TYPE_TOKEN,
  41. );
  42. }
  43. }