-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
[refactor] PersistentLogin for readability and maintainability #5460
base: develop-6.x.x
Are you sure you want to change the base?
Conversation
@@ -31,6 +31,7 @@ | |||
|
|||
import java.security.SecureRandom; | |||
import java.util.*; | |||
import java.util.concurrent.ConcurrentHashMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fine?
@@ -31,6 +31,7 @@ | |||
|
|||
import java.security.SecureRandom; | |||
import java.util.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be replaced by a list of package imports from java.util?
@@ -31,6 +31,7 @@ | |||
|
|||
import java.security.SecureRandom; | |||
import java.util.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please expand the *
/** | ||
* Functions to access the persistent login module. | ||
*/ | ||
public class PersistentLoginFunctions extends UserSwitchingBasicFunction { | ||
private enum Fn { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you give this a better name, as this looks too much on the FN: function namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look if these change are sound.
@@ -60,9 +61,9 @@ public static PersistentLogin getInstance() { | |||
|
|||
public final static int DEFAULT_TOKEN_LENGTH = 16; | |||
|
|||
public final static int INVALIDATION_TIMEOUT = 20000; | |||
public final static int INVALIDATION_TIMEOUT = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check if this is safe to lower the timeout to 1 second, was 20 seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code quality issue (minor)
@@ -197,13 +199,15 @@ public DurationValue getTimeToLive() { | |||
|
|||
public boolean checkAndUpdateToken(String token) { | |||
if (this.token.equals(token)) { | |||
timeoutCheck(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was moved from update method (line 217)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description:
small refactoring of the persistentLogin module
Reference:
Type of tests:
None added