1
0

ClientInterface.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace OAuth2\Storage;
  3. /**
  4. * Implement this interface to specify where the OAuth2 Server
  5. * should retrieve client information
  6. *
  7. * @author Brent Shaffer <bshafs at gmail dot com>
  8. */
  9. interface ClientInterface
  10. {
  11. /**
  12. * Get client details corresponding client_id.
  13. *
  14. * OAuth says we should store request URIs for each registered client.
  15. * Implement this function to grab the stored URI for a given client id.
  16. *
  17. * @param $client_id
  18. * Client identifier to be check with.
  19. *
  20. * @return array
  21. * Client details. The only mandatory key in the array is "redirect_uri".
  22. * This function MUST return FALSE if the given client does not exist or is
  23. * invalid. "redirect_uri" can be space-delimited to allow for multiple valid uris.
  24. * <code>
  25. * return array(
  26. * "redirect_uri" => REDIRECT_URI, // REQUIRED redirect_uri registered for the client
  27. * "client_id" => CLIENT_ID, // OPTIONAL the client id
  28. * "grant_types" => GRANT_TYPES, // OPTIONAL an array of restricted grant types
  29. * "user_id" => USER_ID, // OPTIONAL the user identifier associated with this client
  30. * "scope" => SCOPE, // OPTIONAL the scopes allowed for this client
  31. * );
  32. * </code>
  33. *
  34. * @ingroup oauth2_section_4
  35. */
  36. public function getClientDetails($client_id);
  37. /**
  38. * Get the scope associated with this client
  39. *
  40. * @return
  41. * STRING the space-delineated scope list for the specified client_id
  42. */
  43. public function getClientScope($client_id);
  44. /**
  45. * Check restricted grant types of corresponding client identifier.
  46. *
  47. * If you want to restrict clients to certain grant types, override this
  48. * function.
  49. *
  50. * @param $client_id
  51. * Client identifier to be check with.
  52. * @param $grant_type
  53. * Grant type to be check with
  54. *
  55. * @return
  56. * TRUE if the grant type is supported by this client identifier, and
  57. * FALSE if it isn't.
  58. *
  59. * @ingroup oauth2_section_4
  60. */
  61. public function checkRestrictedGrantType($client_id, $grant_type);
  62. }