<<

NAME

Koha::Auth::TwoFactorAuth- Koha class deal with Two factor authentication

SYNOPSIS

use Koha::Auth::TwoFactorAuth;

my $secret = Koha::AuthUtils::generate_salt( 'weak', 16 ); my $auth = Koha::Auth::TwoFactorAuth->new({ patron => $patron, secret => $secret }); my $image_src = $auth->qr_code; my $ok = $auth->verify( $pin_code, 1 );

It's based on Auth::GoogleAuth

METHODS

new

    $obj = Koha::Auth::TwoFactorAuth->new({ patron => $p, secret => $s });

    Patron is mandatory.
    Secret is optional, defaults to patron's secret.
    Passing secret32 overrules secret! Secret32 should be base32.

qr_code

    my $image_src = $auth->qr_code;

    Replacement for (unsafer) Auth::GoogleAuth::qr_code.
    Returns the data URL to fill the src attribute of the
    image tag on the registration form.

verify

    my $verified = $auth->verify($otp_token);

    Replacement for Auth::GoogleAuth::verify.
    This uses a system wide default for range.

<<