ScopeInterface.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace OAuth2\Storage;
  3. /**
  4. * Implement this interface to specify where the OAuth2 Server
  5. * should retrieve data involving the relevent scopes associated
  6. * with this implementation.
  7. *
  8. * @author Brent Shaffer <bshafs at gmail dot com>
  9. */
  10. interface ScopeInterface
  11. {
  12. /**
  13. * Check if the provided scope exists.
  14. *
  15. * @param $scope
  16. * A space-separated string of scopes.
  17. *
  18. * @return
  19. * TRUE if it exists, FALSE otherwise.
  20. */
  21. public function scopeExists($scope);
  22. /**
  23. * The default scope to use in the event the client
  24. * does not request one. By returning "false", a
  25. * request_error is returned by the server to force a
  26. * scope request by the client. By returning "null",
  27. * opt out of requiring scopes
  28. *
  29. * @param $client_id
  30. * An optional client id that can be used to return customized default scopes.
  31. *
  32. * @return
  33. * string representation of default scope, null if
  34. * scopes are not defined, or false to force scope
  35. * request by the client
  36. *
  37. * ex:
  38. * 'default'
  39. * ex:
  40. * null
  41. */
  42. public function getDefaultScope($client_id = null);
  43. }