mozilla / node-client-sessions

secure sessions stored in cookies
Mozilla Public License 2.0
759 stars 104 forks source link

Unable to determine the session expiration value #82

Open tciuro opened 10 years ago

tciuro commented 10 years ago

Given a session, is it possible to determine what the expiration date is? I was hoping to have access to expiresIn or a similar property, but I don't see any property I can use.

Any ideas? Thanks!

seanmonstar commented 10 years ago

There doesn't appear to be a value exposed to figure this out.

tciuro commented 10 years ago

Would it be possible to expose the expiresIn value?

seanmonstar commented 10 years ago

I'd consider an expiresAt method. however, adding any property to the exposed object would be a breaking change. If anyone's session included a property with same name (perhaps a different purpose), they wouldn't be able to access it anymore ...

tciuro commented 10 years ago

I understand. Perhaps add an underbar to indicate internal/private ownership? (i.e. _expiresAt). Another option could be prefixing the property (i.e. client_session_expiresAt). The likelihood of a collision would be minimized.

mstade commented 9 years ago

You could put these special functions or properties on a prototype object:

var session = Object.create({ expiresAt: ... })

Then if someone sets expiresAt on the session they'll just shadow the prototype, and no one's application is broken.

mderazon commented 9 years ago

@mstade can you elaborate a little ?

mderazon commented 9 years ago

I think it will be great if there were debug options for this lib so we can run it in debug mode to get all kind of the information.

Was thinking about debug module. I can send a PR, I will add debug on the expiresAt variable, but I don't exactly know what other session state variables are interesting