Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user specific token lifespans #704

Merged
merged 1 commit into from
Oct 7, 2017
Merged

Allow user specific token lifespans #704

merged 1 commit into from
Oct 7, 2017

Conversation

codez
Copy link
Contributor

@codez codez commented Aug 16, 2016

Instead of keeping the token lifespan only in the global configuration, we added a corresponding method in the User Module. This method may be overriden to return a user specific value for the token lifespan. By default, the global value is used.

Use case: We have users working all day with the application in the company headquarters, who do not want to login after short breaks. Other users access the application just for a few minutes from public computers, for whom we prefer to have a very short token lifespan.

@MaicolBen
Copy link
Collaborator

Good work, but seems a specific use case of this gem, I don't know if everyone wants that. Don't you need a migration for this?

@codez
Copy link
Contributor Author

codez commented Mar 27, 2017

That's why I implemented the default token_lifespan method of a User it in an unobtrusive way. The behavior remains the same if you do not want to use this feature. You do not have to care in this case.

If the feature is used, it is left to the programmer to provide a decent implementation for this method. The most obvious case is an accessor method for a database column, and the a migration would be needed. But it really might be anything, so the programmer has full flexibility.

@zachfeldman
Copy link
Contributor

Seems fairly straightforward, especially if it doesn't impact default behavior.

@MaicolBen
Copy link
Collaborator

Yeah, this gives more flexibility. I checked and resource isn't null everywhere you replaced the default behavior.

@MaicolBen MaicolBen merged commit 8b9082f into lynndylanhurley:master Oct 7, 2017
@zachfeldman
Copy link
Contributor

👍 we should cut a release soon...

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

Successfully merging this pull request may close these issues.

3 participants