Commit Graph

61 Commits (master)

Author SHA1 Message Date
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 week ago
Joas Schilling 42be7a5d74
fix(OCP): Add since tag for all constants
Signed-off-by: Joas Schilling <coding@schilljs.com>
4 months ago
Côme Chilliet 33a24134a7
Improve docblock annotations for tokens and their exceptions
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
7 months ago
Côme Chilliet 1bdf952fde
Make sure that OC interfaces returns OC interfaces for backward compatibility
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
7 months ago
Côme Chilliet b82e25ea7a
Move Exceptions used in OCP to OCP
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
7 months ago
Côme Chilliet f94fb33062
Move IToken and IProvider::getToken to OCP
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
8 months ago
Joas Schilling dac31ad101
fix!: Remove legacy event dispatching Symfony's GenericEvent from 2FA Manager
Signed-off-by: Joas Schilling <coding@schilljs.com>
10 months ago
Joas Schilling 05aa39d777
Fix event names of 2FA related typed events
Signed-off-by: Joas Schilling <coding@schilljs.com>
11 months ago
Artur Neumann 565fad8d8c
added @since tag
Signed-off-by: Artur Neumann <artur@jankaritech.com>
1 year ago
Artur Neumann f634badf12
public interface to invalidate tokens of user
Signed-off-by: Artur Neumann <artur@jankaritech.com>
1 year ago
Côme Chilliet f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 year ago
Roeland Jago Douma 77df92cabf
feat: add event for failed logins
Apps might also like to know about failed logins.
This adds that event.
The private interface changes are backwards compatible so all should be fine.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2 years ago
Carl Schwan bfd2b74c68 Fix wrong types in phpdoc for twofactor registry
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2 years ago
MichaIng 21b3e87c77 Allow SSO authentication to provide a user secret
Implementing PR #24837 from immerda

Signed-off-by: MichaIng <micha@dietpi.com>
2 years ago
Anna Larch f68028e85e Specify string as nullable for credentials password
Signed-off-by: Anna Larch <anna@nextcloud.com>
2 years ago
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
3 years ago
Roeland Jago Douma 3c5cf825b3 Add real events for enabled 2fa providers for users
* Shiny new events
* Listener to still emit the old event

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
3 years ago
Christoph Wurst 4fc0b2c639
Deprecate all remaining event constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
3 years ago
Christoph Wurst d9015a8c94
Format code to a single space around binary operators
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Roeland Jago Douma b5e9f7e846
Merge pull request #22432 from nextcloud/enh/phpdoc
Add php docs build script
4 years ago
Julius Härtl 45a474071e
Remove @package annotations from public namespace
Signed-off-by: Julius Härtl <jus@bitgrid.net>
4 years ago
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Morris Jobke 725fecee34
Merge pull request #21344 from nextcloud/fix/twofactor-cleanup-event
Emit an event for every disabled 2FA provider during cleanup
4 years ago
Morris Jobke 782a2df392
Add PHP doc for events
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
4 years ago
Joas Schilling 0dfcc132ca
Allow to register AlternativeLogin on RegistrationContext
Signed-off-by: Joas Schilling <coding@schilljs.com>
4 years ago
Christoph Wurst 68794ebc92
Emit an event for every disabled 2FA provider during cleanup
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 28f8eb5dba
Add visibility to all constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
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>
4 years ago
Christoph Wurst a8a06a82d2
Remove trailing whitespaces from comments
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 2a529e453a
Use a blank line after the opening tag
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Roeland Jago Douma 84f3d2ddeb
[POC] Event for failed login attempts
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
4 years ago
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
5 years ago
Christoph Wurst 128a460d7b
Add return type hint to credential store and make it strict
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
5 years ago
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* 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>
5 years ago
Christoph Wurst 3174012adf Add event dispatcher to OCP
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
5 years ago
Roeland Jago Douma 579162d7b9
Allow 2FA to be setup on first login
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>
5 years ago
Christoph Wurst cfa524030b
Fix activatable/deactivatable 2fa provider interface typos
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
6 years ago
Christoph Wurst 79a0ee4f4a
Consolidate personal two-factor provider settings
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
6 years ago
Christoph Wurst 45cf2eef56 Let 2FA providers provide their custom icons (dark/light)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
6 years ago
Roeland Jago Douma a95154642d
Emit event on enablign or disabling of 2FA provider
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
6 years ago
Christoph Wurst 7586b19e52
Only allow 2FA state changs if providers support the operation
Ref https://github.com/nextcloud/server/issues/11019.

Add `twofactorauth:cleanup` command

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
6 years ago
Christoph Wurst 30c6130893
Add public interfaces for activable/deactivable 2FA providers
Fixes https://github.com/nextcloud/server/issues/11018.
Required for https://github.com/nextcloud/server/issues/11019.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
6 years ago
Christoph Wurst 13d93f5b25
Make 2FA providers stateful
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>
6 years ago
Roeland Jago Douma 24b12385d0
Strict 2FA
* make OCP\Authentication\TwoFactorAuth strict
* scalar types
* return types

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
6 years ago
Roeland Jago Douma eddd135f14
Dispatch event on twofactor failure and success
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
6 years ago
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
7 years ago
Morris Jobke 0b652648cc Merge pull request #6177 from nextcloud/properly-add-slo-url
Properly allow \OCP\Authentication\IApacheBackend to specify logout URL
7 years ago
Christoph Wurst 6676232a56
Allow 2FA providers to specify their custom CSP
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
7 years ago
Lukas Reschke a04feff9a7
Properly allow \OCP\Authentication\IApacheBackend to specify logout URL
Any `\OCP\Authentication\IApacheBackend` previously had to implement `getLogoutAttribute` which returns a string.
This string is directly injected into the logout `<a>` tag, so returning something like `href="foo"` would result
in `<a href="foo">`.

This is rather error prone and also in Nextcloud 12 broken as the logout entry has been moved with
054e161eb5 inside the navigation manager where one cannot simply inject attributes.

Thus this feature is broken in Nextcloud 12 which effectively leads to the bug described at nextcloud/user_saml#112,
people cannot logout anymore when using SAML using SLO. Basically in case of SAML you have a SLO url which redirects
you to the IdP and properly logs you out there as well.

Instead of monkey patching the Navigation manager I decided to instead change `\OCP\Authentication\IApacheBackend` to
use `\OCP\Authentication\IApacheBackend::getLogoutUrl` instead where it can return a string with the appropriate logout
URL. Since this functionality is only prominently used in the SAML plugin. Any custom app would need a small change but
I'm not aware of any and there's simply no way to fix this properly otherwise.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
7 years ago