aio-libs / aiohttp-security

auth and permissions for aiohttp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Timeouts with remember()

jecarr opened this issue · comments

Hello,

Just wanted to ask, is there a way to apply a timeout to remember() (such that forget() is called after x seconds)? The only thing on timeouts I can see in the aiohttp docs is with ClientSession (and if that is the solution to be used with remember(), I'm not sure how to combine the two).

Thanks

Not sure the question makes sense, you may need to explain your use case further.

If you just want a session that auto-expires, this is handled by whatever implementation you use for the identity provider. e.g. If you use the SessionIdentityPolicy included in aiohttp-security, then you can configure aiohttp-session to use cookies with a given max_age (https://aiohttp-session.readthedocs.io/en/stable/reference.html#aiohttp_session.cookie_storage.EncryptedCookieStorage).

Thanks for the quick reply and sorry I didn't make sense.

I meant dealing with idle sessions specifically (and I realise I didn't state that in my question).

I like the use of max_age and have read the docs from the link you provided so this resolves my issue. Thank you!