Line 0
Link Here
|
0 |
- |
1 |
use Modern::Perl; |
|
|
2 |
use Koha::Installer::Output qw(say_warning say_success say_info); |
3 |
|
4 |
return { |
5 |
bug_number => "39601", |
6 |
description => "Add passkey support to Koha as an authentication mechanism ", |
7 |
up => sub { |
8 |
my ($args) = @_; |
9 |
my ( $dbh, $out ) = @$args{qw(dbh out)}; |
10 |
|
11 |
# Create webauthn_credentials table |
12 |
if ( !TableExists('webauthn_credentials') ) { |
13 |
$dbh->do( |
14 |
q{ |
15 |
CREATE TABLE webauthn_credentials ( |
16 |
id INT AUTO_INCREMENT PRIMARY KEY, |
17 |
borrowernumber INT NOT NULL, |
18 |
credential_id VARBINARY(255) NOT NULL, |
19 |
public_key VARBINARY(1024) NOT NULL, |
20 |
sign_count INT UNSIGNED NOT NULL DEFAULT 0, |
21 |
transports VARCHAR(255) DEFAULT NULL, |
22 |
nickname VARCHAR(255) DEFAULT NULL, |
23 |
created_on DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, |
24 |
last_used DATETIME DEFAULT NULL, |
25 |
CONSTRAINT fk_webauthn_credentials_borrowernumber FOREIGN KEY (borrowernumber) |
26 |
REFERENCES borrowers(borrowernumber) ON DELETE CASCADE, |
27 |
UNIQUE KEY (credential_id) |
28 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
29 |
} |
30 |
); |
31 |
say_success( $out, "Created table 'webauthn_credentials'" ); |
32 |
} else { |
33 |
say_info( $out, "Table 'webauthn_credentials' already exists!" ); |
34 |
} |
35 |
}, |
36 |
}; |