Skip to content

Conversation

@Roszakos
Copy link

@Roszakos Roszakos commented Dec 20, 2025

Summary

Adds an IStatelessProvider interface. Per-user 2FA activation state for providers implementing this interface will not be stored in the database, thus isTwoFactorAuthEnabledForUser method will be called on every login attempt.

Checklist

@Roszakos Roszakos requested review from ArtificialOwl, come-nc, icewind1991 and provokateurin and removed request for a team December 20, 2025 13:22
*/
interface IStatelessProvider extends IProvider {

public function isTwoFactorAuthEnabledForUser(IUser $user): bool;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function isTwoFactorAuthEnabledForUser(IUser $user): bool;

Doesn't add anything sine this method is from the parent interface

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. I added it, because i was concerned it may get removed from the IProvider interface in the future, since the DocBlock of the OC\Authentication\TwoFactorAuth\Manager::fixMissingProviderStates method says "todo: remove in Nextcloud 17 as by then all providers should have been updated" and it is the only usage of isTwoFactorAuthEnabledForUser method.

Anyway, i'm going to remove it from my interface, since there is no need for that at the moment.

Comment on lines 16 to 17
* for user will be checked dynamically and not stored in the database.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* for user will be checked dynamically and not stored in the database.
*/
* for user will be checked dynamically and not stored in the database.
* @since 33.0.0
*/
#[Implementable(since: '33.0.0')]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stateless 2FA providers

3 participants