question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a convenience expiration setter which takes a duration

See original GitHub issue

I 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:open
  • Created 8 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lhazlewoodcommented, Jul 20, 2018

Moving this to 1.0.0 in favor of using the JDK8+ java.time.duration

0reactions
lhazlewoodcommented, Sep 11, 2016

Pull requests (with tests! we enforce 100% code coverage) are welcome!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found