View | Details | Raw Unified | Return to bug 39601
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_39601_add_passkey_support.pl (+53 lines)
Line 0 Link Here
1
# This file is part of Koha.
2
#
3
# Koha is free software; you can redistribute it and/or modify it
4
# under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# Koha is distributed in the hope that it will be useful, but
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with Koha; if not, see <https://www.gnu.org/licenses>.
15
16
use Modern::Perl;
17
use Koha::Installer::Output qw(say_warning say_success say_info);
18
19
return {
20
    bug_number  => "39601",
21
    description => "Add passkey support to Koha as an authentication mechanism",
22
    up          => sub {
23
        my ($args) = @_;
24
        my ( $dbh, $out ) = @$args{qw(dbh out)};
25
26
        # Create webauthn_credentials table
27
        if ( !TableExists('webauthn_credentials') ) {
28
            $dbh->do(
29
                q{
30
                CREATE TABLE `webauthn_credentials` (
31
                    `webauthn_credential_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
32
                    `borrowernumber` int(11) NOT NULL COMMENT 'foreign key to borrowers.borrowernumber',
33
                    `credential_id` varbinary(1024) NOT NULL COMMENT 'WebAuthn credential identifier',
34
                    `public_key` varbinary(1024) NOT NULL COMMENT 'COSE public key for the credential',
35
                    `sign_count` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'signature counter for replay detection',
36
                    `transports` varchar(255) DEFAULT NULL COMMENT 'comma-separated list of authenticator transports',
37
                    `nickname` varchar(255) DEFAULT NULL COMMENT 'user-assigned name for the credential',
38
                    `created_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the credential was registered',
39
                    `last_used_date` datetime DEFAULT NULL COMMENT 'date and time the credential was last used to authenticate',
40
                    PRIMARY KEY (`webauthn_credential_id`),
41
                    UNIQUE KEY `credential_id` (`credential_id`),
42
                    KEY `fk_webauthn_credentials_borrowernumber` (`borrowernumber`),
43
                    CONSTRAINT `fk_webauthn_credentials_borrowernumber` FOREIGN KEY (`borrowernumber`)
44
                        REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
45
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
46
            }
47
            );
48
            say_success( $out, "Created table 'webauthn_credentials'" );
49
        } else {
50
            say_info( $out, "Table 'webauthn_credentials' already exists!" );
51
        }
52
    },
53
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +25 lines)
Lines 7063-7068 CREATE TABLE `virtualshelves` ( Link Here
7063
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
7063
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
7064
/*!40101 SET character_set_client = @saved_cs_client */;
7064
/*!40101 SET character_set_client = @saved_cs_client */;
7065
7065
7066
--
7067
-- Table structure for table `webauthn_credentials`
7068
--
7069
7070
DROP TABLE IF EXISTS `webauthn_credentials`;
7071
/*!40101 SET @saved_cs_client     = @@character_set_client */;
7072
/*!40101 SET character_set_client = utf8mb4 */;
7073
CREATE TABLE `webauthn_credentials` (
7074
  `webauthn_credential_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
7075
  `borrowernumber` int(11) NOT NULL COMMENT 'foreign key to borrowers.borrowernumber',
7076
  `credential_id` varbinary(1024) NOT NULL COMMENT 'WebAuthn credential identifier',
7077
  `public_key` varbinary(1024) NOT NULL COMMENT 'COSE public key for the credential',
7078
  `sign_count` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'signature counter for replay detection',
7079
  `transports` varchar(255) DEFAULT NULL COMMENT 'comma-separated list of authenticator transports',
7080
  `nickname` varchar(255) DEFAULT NULL COMMENT 'user-assigned name for the credential',
7081
  `created_date` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'date and time the credential was registered',
7082
  `last_used_date` datetime DEFAULT NULL COMMENT 'date and time the credential was last used to authenticate',
7083
  PRIMARY KEY (`webauthn_credential_id`),
7084
  UNIQUE KEY `credential_id` (`credential_id`),
7085
  KEY `fk_webauthn_credentials_borrowernumber` (`borrowernumber`),
7086
  CONSTRAINT `fk_webauthn_credentials_borrowernumber` FOREIGN KEY (`borrowernumber`)
7087
    REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE
7088
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
7089
/*!40101 SET character_set_client = @saved_cs_client */;
7090
7066
--
7091
--
7067
-- Table structure for table `z3950servers`
7092
-- Table structure for table `z3950servers`
7068
--
7093
--
7069
- 

Return to bug 39601