(JAVA) Timeout for random token

Asked

Viewed 21 times

1

I’m generating an alphanumeric token that way:

SecureRandom secureRandom = new SecureRandom();
long longToken = Math.abs(secureRandom.nextLong()); 
String random = Long.toString(longToken, 16); 

I need a mechanism that defines the lifetime of this token, so that it is not used more than once (Example: Something in the sense of the JWT timeout). Does anyone have any idea how to do that?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.