1
0

UserCredentialsInterface.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace OAuth2\Storage;
  3. /**
  4. * Implement this interface to specify where the OAuth2 Server
  5. * should retrieve user credentials for the
  6. * "Resource Owner Password Credentials" grant type
  7. *
  8. * @author Brent Shaffer <bshafs at gmail dot com>
  9. */
  10. interface UserCredentialsInterface
  11. {
  12. /**
  13. * Grant access tokens for basic user credentials.
  14. *
  15. * Check the supplied username and password for validity.
  16. *
  17. * You can also use the $client_id param to do any checks required based
  18. * on a client, if you need that.
  19. *
  20. * Required for OAuth2::GRANT_TYPE_USER_CREDENTIALS.
  21. *
  22. * @param $username
  23. * Username to be check with.
  24. * @param $password
  25. * Password to be check with.
  26. *
  27. * @return
  28. * TRUE if the username and password are valid, and FALSE if it isn't.
  29. * Moreover, if the username and password are valid, and you want to
  30. *
  31. * @see http://tools.ietf.org/html/rfc6749#section-4.3
  32. *
  33. * @ingroup oauth2_section_4
  34. */
  35. public function checkUserCredentials($username, $password);
  36. /**
  37. * @return
  38. * ARRAY the associated "user_id" and optional "scope" values
  39. * This function MUST return FALSE if the requested user does not exist or is
  40. * invalid. "scope" is a space-separated list of restricted scopes.
  41. * @code
  42. * return array(
  43. * "user_id" => USER_ID, // REQUIRED user_id to be stored with the authorization code or access token
  44. * "scope" => SCOPE // OPTIONAL space-separated list of restricted scopes
  45. * );
  46. * @endcode
  47. */
  48. public function getUserDetails($username);
  49. }