Kernel::System::TwoFactor

NAME

Kernel::System::TwoFactor

DESCRIPTION

The two-factor authentication backend.

PUBLIC INTERFACE

has UserType

Attribute that holds the type of the user to handle.

has TwoFactorBackends

Attribute that holds the configured backends of the two-factor authentication methods.

has LookupTwoFactorBackends

Attribute that holds a lookup for the configured two-factor authentication methods.

Auth()

The two-factor authentication function.

    my $TwoFactorAuth = $TwoFactorObject->Auth(
        UserLogin      => 'agent-1',    # (required) User login
        TwoFactorToken => '4682791',    # (optional) Token value
        DeviceUUID     => '...',        # (optional) UUID of the trusted device
    );

Returns 1 if two-factor authentication was successful and 0 if at least one two-factor authentication backend was checked, but none were successful. If no two-factor authentication was checked it returns undef.

TwoFactorAvailableMethods()

Get a list for the configured two-factor methods. Optional you can only get the configured list for the given user.

    my @TwoFactorSetupList = $TwoFactorObject->TwoFactorAvailableMethods(
        UserLogin => 'agent-1',  #  optional
    );

Returns

    @TwoFactorSetupList = (
        'AuthenticatorApp',
        'Email',
    );

UserTwoFactorSetupRequired()

Checks if two-factor authentication setup is required for a specific user.

    my $TwoFactorSetupRequired = $TwoFactorObject->UserTwoFactorSetupRequired(
        UserLogin                 => 'agent-1', # (required) User login
        CheckIsMethodSetupForUser => 0,         # (optional) default is 1
    );

Returns 1 if two-factor authentication is required.

UserTwoFactorAuthRequired()

Checks if two-factor authentication is required for a specific user.

    my $TwoFactorAuthRequired = $TwoFactorObject->UserTwoFactorAuthRequired(
        UserLogin => 'agent-1', # (required) User login
    );

Returns 1 if two-factor authentication is required.

UserTwoFactorMethod()

Get the default two-factor authentication method for the given user.

    my $TwoFactorMethod = $TwoFactorObject->UserTwoFactorMethod(
        UserLogin => 'agent-1',  # (required) User login
    );

Returns

    $TwoFactorMethod = 'AuthenticatorApp';

PRIVATE INTERFACE

_UserTypeUC()

Returns user type value with first character in uppercase.

    # $Self->UserType() = 'agent';
    my $Result = $Self->_UserTypeUC();
    $Result = 'Agent';

_BuildTwoFactorBackends()

Fetches two-factor backend configuration from SysConfig and create a object instance for every two-factor backend in the TwoFactorBackends attribute.

_BuildLookupTwoFactorBackends()

Generate a lookup for the two-factor backends (from TwoFactorBackends).

Scroll to Top