Wordpress does not use sessions.
I always wondered what mechanism does WP use to maintain a user state when user goes from page to page?
|
Wordpress does not use sessions. I always wondered what mechanism does WP use to maintain a user state when user goes from page to page? |
|||
|
|
|
It uses bare cookies and stores the login state information client side.
+
=
Where do all these cookies and salt come from?The salt is in your wp-config.php file:
The unique phrases are used in a cryptographic hash functionThe authentication cookie, the name of which is stored inside of AUTH_COOKIE, which is formed by concatenating “wordpress_” with the md5 sum of the siteurl set in default-constants.php. This is the default behavior and can be overridden from inside your configuration file, by setting up some of the constants upfront. The authentication cookie a concatenation of the username, a timestamp until which the authentication cookie is valid., and an HMAC, which is sort of a key-biased hash for those who pulled of a TL;DR right now. The three variables are concatenated with the pipe character |. Here is how the HMAC is constructed:
Is this secure?According to this article where most of the information in this answer came from it would take a hacker about week to brute force in sending 30 requests a second if they knew what your unique phrase was and 200,000,000,000,000,000,000,000,000,000,000 times harder if your keys are unique. |
|||||||||||
|
|
Cookies are just the client-side storage of session data... WordPress Cookies In fact, one can have cookies without sessions, but no sessions without cookies. |
|||||||||
|