summaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Fix unit testsJoas Schilling2023-02-091-47/+42
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* PublickKeyTokenProvider: Fix password update routine with password hashMarcel Klehr2023-01-041-0/+2
| | | | Signed-off-by: Marcel Klehr <mklehr@gmx.net>
* Fix PublicKeyTokenProviderTest import and mockChristoph Wurst2022-11-101-4/+2
| | | | | | | * IDBConnection import missing * Atomic doesn't need a mock Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Run session token renewals in a database transactionChristoph Wurst2022-10-181-2/+18
| | | | | | | | | | | | | The session token renewal does 1) Read the old token 2) Write a new token 3) Delete the old token If two processes succeed to read the old token there can be two new tokens because the queries were not run in a transaction. This is particularly problematic on clustered DBs where 1) would go to a read node and 2) and 3) go to a write node. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Merge pull request #31499 from nextcloud/bugfix/empty-secretCarl Schwan2022-10-171-3/+15
|\ | | | | Add fallback routines for empty secret cases
| * Fix unit testsCarl Schwan2022-03-101-3/+15
| | | | | | | | Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* | Handle one time password betterCarl Schwan2022-07-281-1/+9
| | | | | | | | Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* | Handler large passwordsCarl Schwan2022-07-051-0/+19
| | | | | | | | | | | | | | | | | | | | | | For passwords bigger than 250 characters, use a bigger key since the performance impact is minor (around one second to encrypt the password). For passwords bigger than 470 characters, give up earlier and throw exeception recommanding admin to either enable the previously enabled configuration or use smaller passwords. Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* | Handle one time passwordsCarl Schwan2022-07-051-4/+56
| | | | | | | | | | | | | | | | This adds an option to disable storing passwords in the database. This might be desirable when using single use token as passwords or very large passwords. Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* | Fix user agent trimming on installationJoas Schilling2022-05-091-2/+7
| | | | | | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* | Fix unit testsJoas Schilling2022-03-231-47/+36
|/ | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* More test fixingJoas Schilling2021-12-011-2/+0
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* More test fixingJoas Schilling2021-12-011-32/+1
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Prevent duplicate auth token activity updatesChristoph Wurst2021-10-221-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | The auth token activity logic works as follows * Read auth token * Compare last activity time stamp to current time * Update auth token activity if it's older than x seconds This works fine in isolation but with concurrency that means that occasionally the same token is read simultaneously by two processes and both of these processes will trigger an update of the same row. Affectively the second update doesn't add much value. It might set the time stamp to the exact same time stamp or one a few seconds later. But the last activity is no precise science, we don't need this accuracy. This patch changes the UPDATE query to include the expected value in a comparison with the current data. This results in an affected row when the data in the DB still has an old time stamp, but won't affect a row if the time stamp is (nearly) up to date. This is a micro optimization and will possibly not show any significant performance improvement. Yet in setups with a DB cluster it means that the write node has to send fewer changes to the read nodes due to the lower number of actual changes. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Always renew apppasswords on loginRoeland Jago Douma2021-02-101-17/+1
| | | | | | | | Else you can end up that you renewed your password (LDAP for example). But they still don't work because you did not use them before you logged in. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Use PSR logger in authenticationJoas Schilling2020-10-121-3/+3
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Allow configuring the activity update interval of tokenRoeland Jago Douma2020-10-041-0/+6
| | | | | | | | On some systems with a lot of users this creates a lot of extra DB writes. Being able to increase this interval helps there. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Change PHPDoc type hint from PHPUnit_Framework_MockObject_MockObject to ↵Morris Jobke2020-08-121-8/+8
| | | | | | \PHPUnit\Framework\MockObject\MockObject Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Format control structures, classes, methods and functionChristoph Wurst2020-04-101-1/+0
| | | | | | | | | | | | | | | To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Unify function spacing to PSR2 recommendationChristoph Wurst2020-04-091-2/+2
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Use the shorter phpunit syntax for mocked return valuesChristoph Wurst2020-03-251-5/+5
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Mode to modern phpunitRoeland Jago Douma2019-11-271-9/+9
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Make phpunit8 compatibleRoeland Jago Douma2019-11-271-1/+1
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Some php-cs fixesRoeland Jago Douma2019-11-221-1/+1
| | | | | | | | | | | * Order the imports * No leading slash on imports * Empty line before namespace * One line per import * Empty after imports * Emmpty line at bottom of file Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Move ExpiredTokenException to the correct namespaceRoeland Jago Douma2018-10-301-3/+1
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add testsRoeland Jago Douma2018-10-021-0/+72
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add openssl to mockDaniel Kesselberg2018-09-161-0/+1
| | | | Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
* Add more testsRoeland Jago Douma2018-06-181-1/+33
| | | | | | | | * Add a lot of tests * Fixes related to those tests * Fix tests Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* SetPassword on PublicKeyTokensRoeland Jago Douma2018-06-181-6/+15
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add first testsRoeland Jago Douma2018-06-181-0/+465
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>