SignatureInterface.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Aws\Signature;
  3. use Aws\Credentials\CredentialsInterface;
  4. use Psr\Http\Message\RequestInterface;
  5. /**
  6. * Interface used to provide interchangeable strategies for signing requests
  7. * using the various AWS signature protocols.
  8. */
  9. interface SignatureInterface
  10. {
  11. /**
  12. * Signs the specified request with an AWS signing protocol by using the
  13. * provided AWS account credentials and adding the required headers to the
  14. * request.
  15. *
  16. * @param RequestInterface $request Request to sign
  17. * @param CredentialsInterface $credentials Signing credentials
  18. *
  19. * @return RequestInterface Returns the modified request.
  20. */
  21. public function signRequest(
  22. RequestInterface $request,
  23. CredentialsInterface $credentials
  24. );
  25. /**
  26. * Create a pre-signed request.
  27. *
  28. * @param RequestInterface $request Request to sign
  29. * @param CredentialsInterface $credentials Credentials used to sign
  30. * @param int|string|\DateTimeInterface $expires The time at which the URL should
  31. * expire. This can be a Unix timestamp, a PHP DateTime object, or a
  32. * string that can be evaluated by strtotime.
  33. *
  34. * @return RequestInterface
  35. */
  36. public function presign(
  37. RequestInterface $request,
  38. CredentialsInterface $credentials,
  39. $expires,
  40. array $options = []
  41. );
  42. }