UserClaimsInterface.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace OAuth2\OpenID\Storage;
  3. /**
  4. * Implement this interface to specify where the OAuth2 Server
  5. * should retrieve user claims for the OpenID Connect id_token.
  6. */
  7. interface UserClaimsInterface
  8. {
  9. // valid scope values to pass into the user claims API call
  10. const VALID_CLAIMS = 'profile email address phone';
  11. // fields returned for the claims above
  12. const PROFILE_CLAIM_VALUES = 'name family_name given_name middle_name nickname preferred_username profile picture website gender birthdate zoneinfo locale updated_at';
  13. const EMAIL_CLAIM_VALUES = 'email email_verified';
  14. const ADDRESS_CLAIM_VALUES = 'formatted street_address locality region postal_code country';
  15. const PHONE_CLAIM_VALUES = 'phone_number phone_number_verified';
  16. /**
  17. * Return claims about the provided user id.
  18. *
  19. * Groups of claims are returned based on the requested scopes. No group
  20. * is required, and no claim is required.
  21. *
  22. * @param $user_id
  23. * The id of the user for which claims should be returned.
  24. * @param $scope
  25. * The requested scope.
  26. * Scopes with matching claims: profile, email, address, phone.
  27. *
  28. * @return
  29. * An array in the claim => value format.
  30. *
  31. * @see http://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
  32. */
  33. public function getUserClaims($user_id, $scope);
  34. }