aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication
Commit message (Collapse)AuthorAgeFilesLines
* fix: Handle exception when clearing previously removed two factor tokensbackport/48933/stable29Daniel Calviño Sánchez2024-11-051-0/+32
| | | | | | | | If a token was already removed from the database but not from the configuration clearing the tokens will try to remove it again from the database, which caused a DoesNotExistException to be thrown. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* fix: Clear pending two factor tokens also from configurationDaniel Calviño Sánchez2024-11-051-0/+26
| | | | | | | | | Otherwise as the tokens were removed from the database but not from the configuration the next time that the tokens were cleared the previous tokens were still got from the configuration, and trying to remove them again from the database ended in a DoesNotExistException being thrown. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
* fix: crypto added manually as expectedyemkareems2024-10-281-1/+1
| | | | Signed-off-by: yemkareems <yemkareems@gmail.com>
* fix: crypto type made not nullable and tests run using ICryptoyemkareems2024-10-281-4/+3
| | | | Signed-off-by: yemkareems <yemkareems@gmail.com>
* fix: encrypt and store password, decrypt and retrieve the sameyemkareems2024-10-281-2/+19
| | | | Signed-off-by: yemkareems <yemkareems@gmail.com>
* Refactor `OC\Server::getHasher`Andrew Summers2024-03-151-1/+1
| | | | Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
* feat(perf): add cache for authtoken lookupBenjamin Gaussorgues2024-02-282-17/+13
| | | | Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
* AppAPI: allowed to bypass Two-FactorAlexander Piskun2023-12-281-4/+19
| | | | Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
* chore: apply changes from Nextcloud coding standards 1.1.1Joas Schilling2023-11-231-1/+1
| | | | | Signed-off-by: Joas Schilling <coding@schilljs.com> Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
* Add tests for occ user:auth-tokens:deleteLucas Azevedo2023-08-253-6/+44
| | | | Signed-off-by: Lucas Azevedo <lhs_azevedo@hotmail.com>
* Fix various deprecation warnings in tests on PHP 8.3Côme Chilliet2023-08-141-0/+3
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* fix!: Remove legacy event dispatching Symfony's GenericEvent from 2FA ManagerJoas Schilling2023-07-271-11/+4
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Fix event names of 2FA related typed eventsJoas Schilling2023-07-031-2/+20
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Adapt tests to config value typingCôme Chilliet2023-04-052-5/+12
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* unit tests for Manager::invalidateTokensOfUserArtur Neumann2023-03-141-0/+44
| | | | Signed-off-by: Artur Neumann <artur@jankaritech.com>
* Fix unit testsJoas Schilling2023-02-091-47/+42
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* composer run cs:fixCôme Chilliet2023-01-2028-29/+0
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.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>
* Skip general login with email for non-valid addresses and LDAPJulius Härtl2022-10-261-2/+3
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* 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>
* | Automatically cut the token name on the first levelJoas Schilling2022-03-231-0/+31
| | | | | | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* | Fix unit testsJoas Schilling2022-03-232-73/+58
|/ | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* More test fixingJoas Schilling2021-12-012-4/+0
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* More test fixingJoas Schilling2021-12-012-235/+6
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* More unit test adjustmentsJoas Schilling2021-12-014-878/+0
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Fix test class namesCôme Chilliet2021-11-232-2/+2
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.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>
* Fix Authentication testJoas Schilling2021-04-221-4/+5
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Move 2FA registration to IBootstrapRoeland Jago Douma2021-04-201-1/+38
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix unit testRoeland Jago Douma2021-04-1613-15/+14
| | | | | | | | | * Fix namespace * Fix test Was broken after https://github.com/nextcloud/server/pull/26529 Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add real events for enabled 2fa providers for usersRoeland Jago Douma2021-03-221-0/+7
| | | | | | | * Shiny new events * Listener to still emit the old event Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* 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>
* Convert 2FA token type to stringChristoph Wurst2021-01-221-5/+5
| | | | | | | | The IConfig service is documented to handle its data as strings, hence this changes the code a bit to ensure we store keys as string and convert them back when reading. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Use PSR logger in authenticationJoas Schilling2020-10-1210-36/+35
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Format code to a single space around binary operatorsChristoph Wurst2020-10-053-4/+4
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* 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>
* Fix undefined class property access after upgrade from 19 to 20Christoph Wurst2020-09-071-0/+76
| | | | | | | | | The serialized data in 19 has one property less and this was not considered in the code. Hence adding a fallback. Moreover I'm changing the deserialization into an array instead of object, as that is the safer option. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* adapt testGetLoginCredentialsInvalidTokenLoginCredentials() unit test to uid ↵Lionel Elie Mamane2020-08-201-3/+4
| | | | | | != loginname Signed-off-by: Lionel Elie Mamane <lionel@mamane.lu>
* Merge pull request #21344 from nextcloud/fix/twofactor-cleanup-eventMorris Jobke2020-08-132-6/+30
|\ | | | | Emit an event for every disabled 2FA provider during cleanup
| * Emit an event for every disabled 2FA provider during cleanupChristoph Wurst2020-06-162-6/+30
| | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* | Change PHPDoc type hint from PHPUnit_Framework_MockObject_MockObject to ↵Morris Jobke2020-08-126-35/+33
|/ | | | | | \PHPUnit\Framework\MockObject\MockObject Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Clean up auth tokens when user is deletedChristoph Wurst2020-06-151-0/+117
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Do not create remember me cookieJulius Härtl2020-04-231-1/+24
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>