Initialize lastCheck when creating session token #28468
Merged
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.
Hello there!
Description
With this change applied,
DefaultTokenProviderinitially sets thelastChecktimestamp to the current time when generating new tokens.Related Issue
#28467
Motivation and Context
On ownCloud master, each user login via the
user_ldapapp sends two bind requests to the LDAP backend. This breaks 2FA (because one-time passwords are reused). See #28467 and #26065 for more details.The second LDAP bind request is triggered by an initial user session validation right after a successful login. This checks the user password (i.e. sends a bind request). If we set
lastCheckof new tokens to the current time, this initial check is skipped. As a result, a user login only sends one LDAP Bind Request, which (1) improves performance and (2) makes it possible to implement 2FA in the LDAP backend.This change fixes #28467, but I don't know enough about the ownCloud internals to evaluate whether this change is sensible. Does setting the
lastChecktime like this have any security implications?How Has This Been Tested?
Manually checked that a user login only sends one LDAP bind request.
Please note that in order to test this on the current master, #28450 needs to be applied first! Otherwise, login via
user_ldapfails generally.Types of changes
Checklist:
Thanks!