X Tutup
Skip to content

Commit d4d8b28

Browse files
committed
Allow usernames to be case-insensitive with app passwords
1 parent 45c3b42 commit d4d8b28

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

lib/private/User/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ private function validateToken($token, $user = null) {
919919
);
920920

921921
// Check if login names match
922-
if ($user !== null && $dbToken->getLoginName() !== $user) {
922+
if ($user !== null && \strcasecmp($dbToken->getLoginName(), $user) !== 0) {
923923
// TODO: this makes it impossible to use different login names on browser and client
924924
// e.g. login by e-mail 'user@example.com' on browser for generating the token will not
925925
// allow to use the client token with the login name 'user'.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@api @notToImplementOnOCIS
2+
Feature: usernames are case-insensitive in webDAV requests with app passwords
3+
4+
Background:
5+
Given these users have been created with default attributes and without skeleton files:
6+
| username |
7+
| Alice |
8+
And user "Alice" has uploaded file with content "some data" to "/textfile0.txt"
9+
And user "Alice" has uploaded file with content "some data" to "/textfile1.txt"
10+
And user "Alice" has created folder "/PARENT"
11+
And user "Alice" has created folder "/FOLDER"
12+
And user "Alice" has uploaded file with content "some data" to "/PARENT/parent.txt"
13+
14+
15+
Scenario: send PUT requests to webDav endpoints using app password token as password and lowercase of username
16+
Given token auth has been enforced
17+
And a new browser session for "Alice" has been started
18+
And the user has generated a new app password named "my-client"
19+
When the user "alice" requests these endpoints with "PUT" with body "doesnotmatter" using basic auth and generated app password about user "Alice"
20+
| endpoint |
21+
| /remote.php/webdav/textfile0.txt |
22+
| /remote.php/dav/files/%username%/textfile1.txt |
23+
| /remote.php/dav/files/%username%/PARENT/parent.txt |
24+
Then the HTTP status code of responses on all endpoints should be "204"
25+
When the user "alice" requests these endpoints with "PUT" with body "doesnotmatter" using basic auth and generated app password about user "Alice"
26+
| endpoint |
27+
# this folder is created, so gives 201 - CREATED
28+
| /remote.php/webdav/PARENS |
29+
| /remote.php/dav/files/%username%/FOLDERS |
30+
Then the HTTP status code of responses on all endpoints should be "201"
31+
When the user "alice" requests these endpoints with "PUT" with body "doesnotmatter" using basic auth and generated app password about user "Alice"
32+
| endpoint |
33+
# this folder already exists so gives 409 - CONFLICT
34+
| /remote.php/dav/files/%username%/FOLDER |
35+
Then the HTTP status code of responses on all endpoints should be "409"

0 commit comments

Comments
 (0)
X Tutup