AuthenticationInterface.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Rest;
  6. /**
  7. * Temando Rest Authentication Service
  8. *
  9. * @package Temando\Shipping\Rest
  10. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  11. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  12. * @link http://www.temando.com/
  13. */
  14. interface AuthenticationInterface
  15. {
  16. const DATA_KEY_SESSION_TOKEN = 'temando_api_token';
  17. const DATA_KEY_SESSION_TOKEN_EXPIRY = 'temando_api_token_expiry';
  18. const AUTH_SCOPE_ADMIN = 'admin';
  19. /**
  20. * Refresh bearer token.
  21. *
  22. * @param string $username
  23. * @param string $password
  24. * @return void
  25. */
  26. public function authenticate($username, $password);
  27. /**
  28. * Refresh session token if expired.
  29. *
  30. * @param string $accountId
  31. * @param string $bearerToken
  32. * @return void
  33. */
  34. public function connect($accountId, $bearerToken);
  35. /**
  36. * Delete session token.
  37. *
  38. * @return void
  39. */
  40. public function disconnect();
  41. /**
  42. * Force refresh session token.
  43. *
  44. * @param string $accountId
  45. * @param string $bearerToken
  46. * @return void
  47. */
  48. public function reconnect($accountId, $bearerToken);
  49. /**
  50. * Read Temando Session Token.
  51. *
  52. * @return string
  53. */
  54. public function getSessionToken();
  55. /**
  56. * Read Temando Session Token Expiry Date Time.
  57. *
  58. * @return string
  59. */
  60. public function getSessionTokenExpiry();
  61. }