14
14
/**
15
15
* For users that can be authenticated using a password.
16
16
*
17
+ * The __serialize/__unserialize() magic methods can be implemented on the user
18
+ * class to prevent hashed passwords from being put in the session storage.
19
+ * If the password is not stored at all in the session, getPassword() should
20
+ * return null after unserialization, and then, changing the user's password
21
+ * won't invalidate its sessions.
22
+ * In order to invalidate the user sessions while not storing the password hash
23
+ * in the session, it's also possible to hash the password hash before
24
+ * serializing it; crc32c is the only algorithm supported.
25
+ * For example:
26
+ *
27
+ * public function __serialize(): array
28
+ * {
29
+ * $data = (array) $this;
30
+ * $data["\0".self::class."\0password"] = hash('crc32c', $this->password);
31
+ *
32
+ * return $data;
33
+ * }
34
+ *
35
+ * Implement EquatableInteface if you need another logic.
36
+ *
17
37
* @author Robin Chalas <[email protected] >
18
38
* @author Wouter de Jong <[email protected] >
19
39
*/
@@ -23,9 +43,6 @@ interface PasswordAuthenticatedUserInterface
23
43
* Returns the hashed password used to authenticate the user.
24
44
*
25
45
* Usually on authentication, a plain-text password will be compared to this value.
26
- *
27
- * The __serialize/__unserialize() magic methods can be implemented on the user
28
- * class to prevent hashed passwords from being put in the session storage.
29
46
*/
30
47
public function getPassword (): ?string ;
31
48
}
0 commit comments