69 reuse saved jwt auth token until it expire 1#70
Merged
lukasmatusiewicz merged 37 commits intomasterfrom Mar 26, 2025
Merged
Conversation
extract the expiration date from auth token. get the auth token validity duration in sec.
shutdown scheduler if authentication success
fix scheduler schutdown
rm redundant attribute from getItemFromAttributes function
fix scheduler schutdown method
5 tasks
fix nullPointerException
nilsbehlen
requested changes
Jan 30, 2025
| } | ||
| String response = runRequestAsync(ENDPOINT_VALIDATE_CHECK, params, headers, false, POST); | ||
| // Shutdown the scheduler if user successfully authenticated | ||
| if (this.parser.parsePIResponse(response) != null && this.parser.parsePIResponse(response).value) |
Member
There was a problem hiding this comment.
do not call parsePIResponse twice
| */ | ||
| private void retrieveAuthToken() | ||
| { | ||
| String response = runRequestAsync(ENDPOINT_AUTH, serviceAccountParam(), Collections.emptyMap(), false, POST); |
Member
There was a problem hiding this comment.
latch needs to be set again for this to work more than once?
nilsbehlen
reviewed
Feb 10, 2025
| authTokenLatch.countDown(); | ||
|
|
||
| // Create a new CountDownLatch for the next token retrieval | ||
| authTokenLatch = new CountDownLatch(1); |
Member
There was a problem hiding this comment.
i think this should be at the start of the function
nilsbehlen
approved these changes
Feb 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to the
privacyIDEAproject, focusing on refactoring the authentication token retrieval process and improving the JSON parsing logic. The most important changes include the introduction of a scheduled task for automatic token retrieval, modifications to theJSONParserclass to handle token expiration, and updates to thePIConstantsclass to include new constants.Authentication Token Management:
PrivacyIDEAto automatically retrieve and refresh the authentication token (retrieveAuthTokenmethod).CountDownLatchto synchronize token retrieval and added a method to get the token (getAuthToken).JSON Parsing Enhancements:
extractAuthTokenmethod inJSONParserto return aLinkedHashMapwith the token and its expiration time.getItemFromAttributesmethod to simplify the retrieval of WebAuthn sign requests.Constants Update:
PIConstants.Code Cleanup and Refactoring:
AsyncRequestCallableto use a finalpathvariable and removed unnecessary code. [1] [2]JSONParserandPIResponse. [1] [2]Test Adjustments: