summaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/TwoFactorAuth
Commit message (Collapse)AuthorAgeFilesLines
* composer run cs:fixCôme Chilliet2023-01-207-7/+0
| | | | Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* Fix unit testsJoas Schilling2022-03-231-26/+22
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* 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>
* 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>
* 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-121-3/+3
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Format code to a single space around binary operatorsChristoph Wurst2020-10-051-2/+2
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* 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-121-4/+3
|/ | | | | | \PHPUnit\Framework\MockObject\MockObject Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Format control structures, classes, methods and functionChristoph Wurst2020-04-107-7/+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>
* Use elseif instead of else ifChristoph Wurst2020-04-101-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Unify function spacing to PSR2 recommendationChristoph Wurst2020-04-092-4/+4
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Use a blank line after the opening tagChristoph Wurst2020-04-094-1/+6
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Merge pull request #20170 from nextcloud/techdebt/remove-unused-importsChristoph Wurst2020-03-272-2/+0
|\ | | | | Remove unused imports
| * Remove unused importsChristoph Wurst2020-03-252-2/+0
| | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* | Use the shorter phpunit syntax for mocked return valuesChristoph Wurst2020-03-252-12/+12
|/ | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Clean up 2FA provider registry when a user is deletedChristoph Wurst2020-01-082-0/+24
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Mode to modern phpunitRoeland Jago Douma2019-11-272-10/+10
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Make phpunit8 compatibleRoeland Jago Douma2019-11-276-6/+6
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Use Symfony's new contract Event class instead of the deprecated oneChristoph Wurst2019-09-121-8/+8
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Allow 2FA to be setup on first loginRoeland Jago Douma2019-05-171-0/+19
| | | | | | | | | Once 2FA is enforced for a user and they have no 2FA setup yet this will now prompt them with a setup screen. Given that providers are enabled that allow setup then. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl> Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Make it possible to enforce mandatory 2FA for groupsChristoph Wurst2018-10-153-34/+216
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Generate backups code notification if not enable but 2fa isRoeland Jago Douma2018-10-011-1/+27
| | | | | | | | | | | | Generate a notification to generate backup codes if you enable an other 2FA provider but backup codes are not yet generated. * Add event listner * Insert background job * Background job tests and emits notification every 2 weeks * If the backup codes are generated the next run will remove the job Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add mandatory 2FA service/classChristoph Wurst2018-09-302-0/+114
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Only allow 2FA state changs if providers support the operationChristoph Wurst2018-09-254-28/+176
| | | | | | | | Ref https://github.com/nextcloud/server/issues/11019. Add `twofactorauth:cleanup` command Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Remove unused importChristoph Wurst2018-08-101-1/+0
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix 2FA being enforced if only backup codes provider is activeChristoph Wurst2018-08-101-0/+27
| | | | | | Fixes https://github.com/nextcloud/server/issues/10634. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix double-inserts of the same provider stateChristoph Wurst2018-08-091-2/+2
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Add integration/unit test for the double-insert of same valuesChristoph Wurst2018-08-091-0/+19
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Rename providerset method to get primary providersChristoph Wurst2018-08-081-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix login redirection if only one 2FA provider is activeChristoph Wurst2018-08-081-0/+18
| | | | | | Fixes https://github.com/nextcloud/server/issues/10500. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix 2FA provider registry population on loginChristoph Wurst2018-08-081-3/+79
| | | | | | | | If the 2FA provider registry has not been populated yet, we have to make sure all available providers are loaded and queried on login. Otherwise previously active 2FA providers aren't detected as enabled. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix duplicate inserts in the 2fa provider registry DAOChristoph Wurst2018-07-311-0/+19
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Make new classes strict and fix license headerChristoph Wurst2018-06-253-4/+22
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Make 2FA providers statefulChristoph Wurst2018-06-205-136/+451
| | | | | | | | | | | This adds persistence to the Nextcloud server 2FA logic so that the server knows which 2FA providers are enabled for a specific user at any time, even when the provider is not available. The `IStatefulProvider` interface was added as tagging interface for providers that are compatible with this new API. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Add all parameters to returnValueMapJulius Härtl2018-01-311-2/+2
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Fix testsRoeland Jago Douma2018-01-251-4/+11
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix AppPassword 2FA authRoeland Jago Douma2017-09-121-1/+16
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix login with basic authRoeland Jago Douma2017-09-051-1/+5
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Improve 2FARoeland Jago Douma2017-08-291-17/+189
| | | | | | | | * Store the auth state in the session so we don't have to query it every time. * Added some tests Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix testsRoeland Jago Douma2017-05-181-4/+4
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Don't do a recursive searchJoas Schilling2017-03-221-1/+1
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* fix 2fa activities testsChristoph Wurst2016-12-201-4/+77
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* bring back remember-meChristoph Wurst2016-11-021-2/+27
| | | | | | | | | | * try to reuse the old session token for remember me login * decrypt/encrypt token password and set the session id accordingly * create remember-me cookies only if checkbox is checked and 2fa solved * adjust db token cleanup to store remembered tokens longer * adjust unit tests Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Do not use underscores in PSR4 namespaces of the backup codes appChristoph Wurst2016-10-031-3/+2
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Fix getMock AuthenticationRoeland Jago Douma2016-09-061-5/+5
|
* add 2fa backup codes appChristoph Wurst2016-09-051-12/+72
| | | | | * add backup codes app unit tests * add integration tests for the backup codes app
* prevent infinite redirect loops if the there is no 2fa provider to passChristoph Wurst2016-08-241-4/+41
| | | | | | | This fixes infinite loops that are caused whenever a user is about to solve a 2FA challenge, but the provider app is disabled at the same time. Since the session value usually indicates that the challenge needs to be solved before we grant access we have to remove that value instead in this special case.