Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Sliding expiration #22

Closed
smanaton opened this issue Feb 15, 2018 · 6 comments
Closed

Sliding expiration #22

smanaton opened this issue Feb 15, 2018 · 6 comments
Assignees
Labels

Comments

@smanaton
Copy link

Hi,

I would like to be able to use sliding expiration, the current token lasts for 5 minutes but i would like to be able to refresh the token everytime a authenticated request is made so to get a rolling 5 minutes, i'm new to vue and aspnetcore but i have worked with .net framework for many years, is this something that can be done easily?

Thanks

Shane

@mrellipse
Copy link
Owner

mrellipse commented Feb 16, 2018

gday! it shouldn't be too much hassle - but it does touch just about every layer in the app.

the gist of it would be

  • edit server/config/extensions.cs:76 and add a handler for OnTokenValidated
  • in the handler call the local authentication service to resolve the user
  • use the returned identity to obtain a new token via token service
  • add the updated access token to the http response header
  • edit ui/app/common/axios.ts:28, and update the axios interceptors to grab the token from response header
  • save the updated access token ( add a new method authentication-service.ts, similar to the existing login.ts method )
  • update the vuex store with new token expiry info

@mrellipse mrellipse self-assigned this Feb 16, 2018
@mrellipse
Copy link
Owner

mrellipse commented Feb 16, 2018

just as an FYI, this stack overflow article JWT token refresh (sliding sessions) and signout is a nice resource

i like the idea of only letting the refresh event occur a max # of times per period - just to restrict the overall time a compromised user token can be used if hijacking occurs!

@smanaton
Copy link
Author

Thanks for this, i will give it a go.

@mrellipse
Copy link
Owner

mrellipse commented Feb 21, 2018 via email

@hmuhdkamran
Copy link
Collaborator

@mrellipse
Copy link
Owner

stale issue. closing for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants