Add a convenience expiration setter which takes a duration
See original GitHub issueI would imagine that when most people are setting an expiration on a JWT, they will be using some configured timeout duration (e.g. 15 minutes). the ClaimsMutator has a basic setExpiration helper which takes the expiration date. It would be great if you added a convenience method which took the duration and did the math to compute the final exipration date, something like:
public T setExpirationAfter(long duration, TimeUnit timeUnit);
Where the impl is something like:
return setExpiration(new Date(System.currentTimeMillis() + timeUnit.toMillis(duration)));
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
"Conflicting setter definitions for property" exception for `Map ...
I've been deserializing Spring's HttpHeaders without issue until I upgraded to latests Spring 2.3.0 which upgraded Jackson from 2.10.3 to ...
Read more >Generating getters/setters in Java (again) - Stack Overflow
I'm with the general consensus - just generate them in the source file using the methods that every IDE gives you. This takes...
Read more >EnvironmentConfig (Oracle - Berkeley DB Java Edition API)
Some commonly used environment attributes have convenience setter/getter ... added to the system clock time for determining that a record may have expired....
Read more >DevicePolicyManager - Android Developers
Activity action: ask the user to add a new device administrator to the system. ... Get the current password expiration time for a...
Read more >Effective Go - The Go Programming Language
Go doesn't provide automatic support for getters and setters. ... Instead the lexer uses a simple rule to insert semicolons automatically as it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Moving this to 1.0.0 in favor of using the JDK8+
java.time.duration
Pull requests (with tests! we enforce 100% code coverage) are welcome!