BeforeUserLoggedInEvent.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\User\Events;
  8. use OCP\Authentication\IApacheBackend;
  9. use OCP\EventDispatcher\Event;
  10. /**
  11. * @since 18.0.0
  12. */
  13. class BeforeUserLoggedInEvent extends Event {
  14. private string $username;
  15. private ?string $password;
  16. private ?IApacheBackend $backend;
  17. /**
  18. * @since 18.0.0
  19. * @since 26.0.0 password can be null
  20. */
  21. public function __construct(string $username, ?string $password, ?IApacheBackend $backend = null) {
  22. parent::__construct();
  23. $this->username = $username;
  24. $this->password = $password;
  25. $this->backend = $backend;
  26. }
  27. /**
  28. * returns the login name, which must not necessarily match to a user ID
  29. *
  30. * @since 18.0.0
  31. */
  32. public function getUsername(): string {
  33. return $this->username;
  34. }
  35. /**
  36. * @since 18.0.0
  37. * @since 26.0.0 value can be null
  38. */
  39. public function getPassword(): ?string {
  40. return $this->password;
  41. }
  42. /**
  43. * return backend if available (or null)
  44. *
  45. * @return IApacheBackend|null
  46. * @since 26.0.0
  47. */
  48. public function getBackend(): ?IApacheBackend {
  49. return $this->backend;
  50. }
  51. }