Reputation: 41
I use Cookie Authentication in a Blazor server side application. Is there a way to check whether cookie has expired?
I've tried to get cookie expiration date with HttpContextAccessor but there's only an encrypted value of a cookie.
Upvotes: 0
Views: 1499
Reputation: 48612
You shouldn't be checking cookie expiration on the server. A legitimate client will remove the cookie itself when it expires, and a rogue client can lie about the expiration. If you want to expire a login token or something, you need to handle it completely separately from the expiration of the cookie itself for it to be secure.
Upvotes: 2