NAME
Kernel::System::TwoFactor::Base
DESCRIPTION
This is the base module for the two-factor authentication backend modules.
PUBLIC INTERFACE
has UserType
Attribute that holds the type of the user to handle.
has Config
Attribute that holds the configuration of the two-factor authentication mechanism.
Key()
Defines the internal key name of the two-factor authentication mechanism module.
GetLabel()
Get the label from the config for the two-factor authentication mechanism module.
IsActive()
Get the information if the two-factor method is active.
IsSetupPossible()
Get the information if the two-factor setup for this method is possible.
GetSetupErrorMessage()
Get a message to display when the setup is not possible.
Auth()
Authenticates user based on the configured two-factor challenge.
my $Success = $Module->Auth( UserLogin => 'agent-1', # (required) User login TwoFactorToken => '4682791', # (optional) Token value );
Returns 1 if two-factor authentication was successful.
GenerateOTP()
Generates OTP
for current user based on the configured two-factor challenge or for the given values.
my $OTP = $Module->GenerateOTP( UserLogin => 'agent-1', # (required) User login
or
Secret => 'BKSDNXEHLQAGRYU2', # optional
Counter => 0, # optional
or
Secret => 'BKSDNXEHLQAGRYU2', # optional
);
Returns generated OTP
:
$OTP = '123456';
Setup()
Setup the two-factor method for the given user.
my $Success = $Module->Setup( UserLogin => 'agent-1', # (required) User login Secret => 'BKSDNXEHLQAGRYU2', Token => '761321', );
Returns 1 for success.
DeleteSetup()
Delete the setup the two-factor method for the given user.
my $Success = $Module->DeleteSetup( UserLogin => 'agent-1', # (required) User login );
Returns 1 for success.
IsMethodSetupForUser()
Determines if user has the two-factor authentication method setup.
my $Success = $Module->IsMethodSetupForUser( UserLogin => 'agent-1', # (required) User login );
Returns 1 if user has two-factor authentication method setup.
IsSendingTokenViaTransport()
Get the information if the token via transport is needed for the two-factor authentication method.
PRIVATE INTERFACE
_UserTypeUC()
Returns user type value with first character in uppercase.
# $Self->UserType() = 'agent';
my $Result = $Self->_UserTypeUC();
$Result = 'Agent';
_BuildConfig()
Fetches module configuration from SysConfig
for storage in the Config
attribute.