diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2012-01-09 14:01:55 +0100 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2012-01-09 14:01:55 +0100 |
commit | 4c21da78b969090d04c5c9c772902a1bfe6cedd5 (patch) | |
tree | 31872a637897781eb167df07b5cd8a3b60ea8eab /Core/User/UserInterface.php | |
parent | 5b47719aba212e7f6f42ad173fa9a231c36579bc (diff) | |
parent | 646b2d922ff94aeba9647665a01235389aae6ff0 (diff) | |
download | symfony-security-4c21da78b969090d04c5c9c772902a1bfe6cedd5.zip symfony-security-4c21da78b969090d04c5c9c772902a1bfe6cedd5.tar.gz symfony-security-4c21da78b969090d04c5c9c772902a1bfe6cedd5.tar.bz2 |
merged 2.0
Diffstat (limited to 'Core/User/UserInterface.php')
-rw-r--r-- | Core/User/UserInterface.php | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/Core/User/UserInterface.php b/Core/User/UserInterface.php index ed6ce0a..85356b7 100644 --- a/Core/User/UserInterface.php +++ b/Core/User/UserInterface.php @@ -12,7 +12,20 @@ namespace Symfony\Component\Security\Core\User; /** - * UserInterface is the interface that user classes must implement. + * Represents the interface that all user classes must implement. + * + * This interface is useful because the authentication layer can deal with + * the object through its lifecycle, using the object to get the encoded + * password (for checking against a submitted password), assigning roles + * and so on. + * + * Regardless of how your user are loaded or where they come from (a database, + * configuration, web service, etc), you will have a class that implements + * this interface. Objects that implement this interface are created and + * loaded by different objects that implement UserProviderInterface + * + * @see UserProviderInterface + * @see AdvancedUserInterface * * @author Fabien Potencier <fabien@symfony.com> */ @@ -21,6 +34,17 @@ interface UserInterface /** * Returns the roles granted to the user. * + * <code> + * public function getRoles() + * { + * return array('ROLE_USER'); + * } + * </code> + * + * Alternatively, the roles might be stored on a ``roles`` property, + * and populated in any number of different ways when the user object + * is created. + * * @return Role[] The user roles */ function getRoles(); @@ -28,12 +52,17 @@ interface UserInterface /** * Returns the password used to authenticate the user. * + * This should be the encoded password. On authentication, a plain-text + * password will be salted, encoded, and then compared to this value. + * * @return string The password */ function getPassword(); /** - * Returns the salt. + * Returns the salt that was originally used to encode the password. + * + * This can return null if the password was not encoded using a salt. * * @return string The salt */ @@ -48,10 +77,17 @@ interface UserInterface /** * Removes sensitive data from the user. + * + * This is important if, at any given point, sensitive information like + * the plain-text password is stored on this object. + * + * @return void */ function eraseCredentials(); /** + * Returns whether or not the given user is equivalent to *this* user. + * * The equality comparison should neither be done by referential equality * nor by comparing identities (i.e. getId() === getId()). * |