Nextcloud PHP API (stable18)

IRegistry

Nextcloud 2FA provider registry for stateful 2FA providers

This service keeps track of which providers are currently active for a specific user. Stateful 2FA providers (IStatefulProvider) must use this service to save their enabled/disabled state.

Tags
since
14.0.0

Table of Contents

EVENT_PROVIDER_DISABLED  = self::class . '::disable'
EVENT_PROVIDER_ENABLED  = self::class . '::enable'
cleanUp()  : void
Cleans up all entries of the provider with the given id. This is only necessary in edge-cases where an admin disabled and/or uninstalled a provider app. Invoking this method will make sure outdated provider associations are removed so that users can log in.
disableProviderFor()  : mixed
Disable the given 2FA provider for the given user
enableProviderFor()  : mixed
Enable the given 2FA provider for the given user
getProviderStates()  : string[]
Get a key-value map of providers and their enabled/disabled state for the given user.

Constants

EVENT_PROVIDER_DISABLED

public mixed EVENT_PROVIDER_DISABLED = self::class . '::disable'

EVENT_PROVIDER_ENABLED

public mixed EVENT_PROVIDER_ENABLED = self::class . '::enable'

Methods

cleanUp()

Cleans up all entries of the provider with the given id. This is only necessary in edge-cases where an admin disabled and/or uninstalled a provider app. Invoking this method will make sure outdated provider associations are removed so that users can log in.

public cleanUp(string $providerId) : void
Parameters
$providerId : string
Tags
since
15.0.0

disableProviderFor()

Disable the given 2FA provider for the given user

public disableProviderFor(IProvider $provider, IUser $user) : mixed
Parameters
$provider : IProvider
$user : IUser
Tags
since
14.0.0
Return values
mixed

enableProviderFor()

Enable the given 2FA provider for the given user

public enableProviderFor(IProvider $provider, IUser $user) : mixed
Parameters
$provider : IProvider
$user : IUser
Tags
since
14.0.0
Return values
mixed

getProviderStates()

Get a key-value map of providers and their enabled/disabled state for the given user.

public getProviderStates(IUser $user) : string[]
Parameters
$user : IUser
Tags
since
14.0.0
Return values
string[]

where the array key is the provider ID (string) and the value is the enabled state (bool)

Search results