CompatAuth.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  10. * @link https://cakephp.org CakePHP(tm) Project
  11. * @since 3.3.0
  12. * @license https://opensource.org/licenses/mit-license.php MIT License
  13. */
  14. namespace TestApp\Http;
  15. use Cake\Http\Client\Request;
  16. /**
  17. * Testing stub to ensure that auth providers
  18. * that mutate requests in place continue to work.
  19. *
  20. * @deprecated 3.3.0 Remove this compatibility behavior in 4.0.0
  21. */
  22. class CompatAuth
  23. {
  24. /**
  25. * Add Authorization header to the request via in-place mutation methods.
  26. *
  27. * @param \Cake\Http\Client\Request $request Request instance.
  28. * @param array $credentials Credentials.
  29. * @return \Cake\Http\Client\Request The updated request.
  30. */
  31. public function authentication(Request $request, array $credentials)
  32. {
  33. $request->header('Authorization', 'Bearer abc123');
  34. }
  35. /**
  36. * Proxy Authentication added via in-place mutation methods.
  37. *
  38. * @param \Cake\Http\Client\Request $request Request instance.
  39. * @param array $credentials Credentials.
  40. * @return \Cake\Http\Client\Request The updated request.
  41. */
  42. public function proxyAuthentication(Request $request, array $credentials)
  43. {
  44. $request->header('Proxy-Authorization', 'Bearer abc123');
  45. }
  46. }