TokenInterface.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace Symfony\Component\Security\Authentication\Token;
  3. /*
  4. * This file is part of the Symfony package.
  5. *
  6. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. /**
  12. * TokenInterface is the interface for the user authentication information.
  13. *
  14. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  15. */
  16. interface TokenInterface extends \Serializable
  17. {
  18. /**
  19. * Returns a string representation of the token.
  20. *
  21. * @return string A string representation
  22. */
  23. function __toString();
  24. /**
  25. * Returns the user roles.
  26. *
  27. * @return Role[] An array of Role instances.
  28. */
  29. function getRoles();
  30. /**
  31. * Returns the user credentials.
  32. *
  33. * @return mixed The user credentials
  34. */
  35. function getCredentials();
  36. /**
  37. * Checks whether the token is immutable or not.
  38. *
  39. * @return Boolean true if the token is immutable, false otherwise
  40. */
  41. function isImmutable();
  42. /**
  43. * Returns a user instance.
  44. *
  45. * @return object The User instance
  46. */
  47. function getUser();
  48. /**
  49. * Checks if the user is authenticated or not.
  50. *
  51. * @return Boolean true if the token has been authenticated, false otherwise
  52. */
  53. function isAuthenticated();
  54. /**
  55. * Sets the authenticated flag.
  56. *
  57. * @param Boolean $isAuthenticated The authenticated flag
  58. */
  59. function setAuthenticated($isAuthenticated);
  60. /**
  61. * Removes sensitive information from the token.
  62. */
  63. function eraseCredentials();
  64. }