Page MenuHomePhorge

Token validation when providing it as a password
ClosedPublic

Authored by mollekopf on Jan 2 2025, 12:00 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Feb 8, 12:54 AM
Unknown Object (File)
Sat, Feb 8, 12:54 AM
Unknown Object (File)
Sat, Feb 8, 12:54 AM
Unknown Object (File)
Sat, Feb 8, 12:54 AM
Unknown Object (File)
Sat, Feb 8, 12:54 AM
Unknown Object (File)
Sat, Feb 8, 12:54 AM
Unknown Object (File)
Sat, Feb 8, 12:54 AM
Unknown Object (File)
Fri, Feb 7, 11:50 PM
Subscribers

Details

Reviewers
machniak
Group Reviewers
Restricted Project
Commits
rK77ced2efb642: Token validation when providing it as a password
Summary

We rely on this because the roundcube files plugin uses the auth/login
route to obtain a token using the password, which is a different token
in case of SSO.

Diff Detail

Repository
rK kolab
Branch
dev/mollekopf
Lint
Lint Skipped
Unit
No Test Coverage
Build Status
Buildable 52562
Build 18632: arc lint + arc unit

Event Timeline

mollekopf created this revision.
mollekopf added a reviewer: Restricted Project.Jan 2 2025, 12:02 AM
machniak requested changes to this revision.Jan 2 2025, 8:56 AM
machniak subscribed.

Placing this in User::validateCredentials() maybe is not a bad idea, but it creates some redundancy. See NGINXController::authorizeRequest() - AuthUtils::tokenValidate() now will be called twice. Also, test this new case in Unit/UserTest::testPasswordValidation().

This revision now requires changes to proceed.Jan 2 2025, 8:56 AM
machniak added inline comments.
src/tests/Unit/UserTest.php
69

It should be assertTrue(), right? A test for "valid token of another user" would be nice too.

This revision now requires changes to proceed.Jan 6 2025, 10:27 AM

After another look I think we might be doing something wrong here. A valid token should disable/skip 2FA use. Current User::findAndAuthenticate() will not skip 2FA if the password is a valid token.

This revision now requires changes to proceed.Jan 6 2025, 11:34 AM

Moved the token validation to findAndAuthenticate, so we can skip mfa when a token has been validated.

This revision is now accepted and ready to land.Jan 6 2025, 12:35 PM