LPAL-1126 Remove check which fails if lastLogin > 5 years ago #1292
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.
Unit tests were failing because of a condition which sets the last login for the user to 'now' if the supplied last login datetime is more than 5 years ago. This was tripped when we passed 2023-01-04, as some of the tests set the last login date to 2018-01-02.
Remove this condition and instead set a default lastLogin if one is not available for a user during an authentication attempt. Also allow the lastLogin to be null when constructing a User, and default to 'now' if this is the case. As we only construct users in LpaAuthAdapter, we shouldn't hit this case, but it is covered anyway.
In LpaAuthAdapter, default the last login to null if the user doesn't have one. Then, when constructing the last login datetime, a null value will mean we default to 'now'.
Purpose
Fixes LPAL-1126
Approach
Explain how your code addresses the purpose of the change
Learning
Any tips and tricks, blog posts or tools which helped you. Plus anything notable you've discovered about the LPA service
Checklist
metadata.json
with the repo location..github/workflows/dependabot-update.yml