You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2017/05/30 18:30:12 UTC

[50/50] [abbrv] ambari git commit: AMBARI-20907. Create Database Schema for Improved User Account Management (rlevas)

AMBARI-20907. Create Database Schema for Improved User Account Management (rlevas)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7460cebf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7460cebf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7460cebf

Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 7460cebf90e8f77b3b14457a64423ebc3ba028cc
Parents: 041d353
Author: Robert Levas <rl...@hortonworks.com>
Authored: Tue May 30 14:29:02 2017 -0400
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Tue May 30 14:29:02 2017 -0400

----------------------------------------------------------------------
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  | 33 ++++++++++++++----
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  | 34 ++++++++++++++-----
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 32 ++++++++++++++----
 .../resources/Ambari-DDL-Postgres-CREATE.sql    | 32 ++++++++++++++----
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 33 ++++++++++++++----
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   | 35 +++++++++++++++-----
 6 files changed, 155 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7460cebf/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index ece6600..32fdf8c 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -275,16 +275,27 @@ CREATE TABLE adminprincipal (
 CREATE TABLE users (
   user_id INTEGER,
   principal_id BIGINT NOT NULL,
-  ldap_user INTEGER NOT NULL DEFAULT 0,
   user_name VARCHAR(255) NOT NULL,
-  user_type VARCHAR(255) NOT NULL DEFAULT 'LOCAL',
-  create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-  user_password VARCHAR(255),
   active INTEGER NOT NULL DEFAULT 1,
+  consecutive_failures INTEGER NOT NULL DEFAULT 0,
   active_widget_layouts VARCHAR(1024) DEFAULT NULL,
+  display_name VARCHAR(255) NOT NULL,
+  local_username VARCHAR(255) NOT NULL,
+  create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
   CONSTRAINT PK_users PRIMARY KEY (user_id),
   CONSTRAINT FK_users_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id),
-  CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type));
+  CONSTRAINT UNQ_users_0 UNIQUE (user_name));
+
+CREATE TABLE user_authentication (
+  user_authentication_id INTEGER,
+  user_id INTEGER NOT NULL,
+  authentication_type VARCHAR(50) NOT NULL,
+  authentication_key CLOB,
+  create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+  update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+  CONSTRAINT PK_user_authentication PRIMARY KEY (user_authentication_id),
+  CONSTRAINT FK_user_authentication_users FOREIGN KEY (user_id) REFERENCES users(user_id)
+);
 
 CREATE TABLE groups (
   group_id INTEGER,
@@ -1061,6 +1072,8 @@ INSERT INTO ambari_sequences (sequence_name, sequence_value)
   UNION ALL
   SELECT 'user_id_seq', 2 FROM SYSIBM.SYSDUMMY1
   UNION ALL
+  SELECT 'user_authentication_id_seq', 2 FROM SYSIBM.SYSDUMMY1
+  UNION ALL
   SELECT 'group_id_seq', 1 FROM SYSIBM.SYSDUMMY1
   UNION ALL
   SELECT 'member_id_seq', 1 FROM SYSIBM.SYSDUMMY1
@@ -1198,8 +1211,14 @@ INSERT INTO adminprincipal (principal_id, principal_type_id)
   UNION ALL
   SELECT 13, 8 FROM SYSIBM.SYSDUMMY1;
 
-INSERT INTO Users (user_id, principal_id, user_name, user_password)
-  SELECT 1, 1, 'admin', '538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00' FROM SYSIBM.SYSDUMMY1;
+-- Insert the default administrator user.
+insert into users(user_id, principal_id, user_name, display_name, local_username, create_time)
+  SELECT 1, 1, 'admin', 'Administrator', 'admin', CURRENT_TIMESTAMP FROM SYSIBM.SYSDUMMY1;
+
+-- Insert the LOCAL authentication data for the default administrator user.
+-- The authentication_key value is the salted digest of the password: admin
+insert into user_authentication(user_authentication_id, user_id, authentication_type, authentication_key, create_time, update_time)
+  SELECT 1, 1, 'LOCAL', '538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP FROM SYSIBM.SYSDUMMY1;
 
 insert into adminpermission(permission_id, permission_name, resource_type_id, permission_label, principal_id, sort_order)
   SELECT 1, 'AMBARI.ADMINISTRATOR', 1, 'Ambari Administrator', 7, 1 FROM SYSIBM.SYSDUMMY1

http://git-wip-us.apache.org/repos/asf/ambari/blob/7460cebf/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index e0f2ef9..2ee7cc3 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -295,16 +295,27 @@ CREATE TABLE adminprincipal (
 CREATE TABLE users (
   user_id INTEGER,
   principal_id BIGINT NOT NULL,
-  create_time TIMESTAMP DEFAULT NOW(),
-  ldap_user INTEGER NOT NULL DEFAULT 0,
-  user_type VARCHAR(100) NOT NULL DEFAULT 'LOCAL',
-  user_name VARCHAR(100) NOT NULL,
-  user_password VARCHAR(255),
+  user_name VARCHAR(255) NOT NULL,
   active INTEGER NOT NULL DEFAULT 1,
+  consecutive_failures INTEGER NOT NULL DEFAULT 0,
   active_widget_layouts VARCHAR(1024) DEFAULT NULL,
+  display_name VARCHAR(255) NOT NULL,
+  local_username VARCHAR(255) NOT NULL,
+  create_time TIMESTAMP DEFAULT NOW(),
   CONSTRAINT PK_users PRIMARY KEY (user_id),
   CONSTRAINT FK_users_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id),
-  CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type));
+  CONSTRAINT UNQ_users_0 UNIQUE (user_name));
+
+CREATE TABLE user_authentication (
+  user_authentication_id INTEGER,
+  user_id INTEGER NOT NULL,
+  authentication_type VARCHAR(50) NOT NULL,
+  authentication_key LONGBLOB,
+  create_time TIMESTAMP NOT NULL DEFAULT 0,
+  update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  CONSTRAINT PK_user_authentication PRIMARY KEY (user_authentication_id),
+  CONSTRAINT FK_user_authentication_users FOREIGN KEY (user_id) REFERENCES users(user_id)
+);
 
 CREATE TABLE groups (
   group_id INTEGER,
@@ -1076,6 +1087,7 @@ INSERT INTO ambari_sequences(sequence_name, sequence_value) VALUES
   ('host_id_seq', 0),
   ('host_role_command_id_seq', 1),
   ('user_id_seq', 2),
+  ('user_authentication_id_seq', 2),
   ('group_id_seq', 1),
   ('member_id_seq', 1),
   ('configgroup_id_seq', 1),
@@ -1150,8 +1162,14 @@ INSERT INTO adminprincipal (principal_id, principal_type_id) VALUES
   (12, 8),
   (13, 8);
 
-INSERT INTO users(user_id, principal_id, user_name, user_password)
-  SELECT 1, 1, 'admin','538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00';
+-- Insert the default administrator user.
+INSERT INTO users(user_id, principal_id, user_name, display_name, local_username, create_time)
+  SELECT 1, 1, 'admin', 'Administrator', 'admin', NOW();
+
+-- Insert the LOCAL authentication data for the default administrator user.
+-- The authentication_key value is the salted digest of the password: admin
+INSERT INTO user_authentication(user_authentication_id, user_id, authentication_type, authentication_key, create_time, update_time)
+  SELECT 1, 1, 'LOCAL', '538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00', NOW(), NOW();
 
 INSERT INTO adminpermission(permission_id, permission_name, resource_type_id, permission_label, principal_id, sort_order)
   SELECT 1, 'AMBARI.ADMINISTRATOR', 1, 'Ambari Administrator', 7, 1 UNION ALL

http://git-wip-us.apache.org/repos/asf/ambari/blob/7460cebf/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 6d0f856..82cbbe5 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -275,16 +275,27 @@ CREATE TABLE adminprincipal (
 CREATE TABLE users (
   user_id NUMBER(10) NOT NULL,
   principal_id NUMBER(19) NOT NULL,
-  create_time TIMESTAMP NULL,
-  ldap_user NUMBER(10) DEFAULT 0,
   user_name VARCHAR2(255) NULL,
-  user_type VARCHAR(255) DEFAULT 'LOCAL',
-  user_password VARCHAR2(255) NULL,
   active INTEGER DEFAULT 1 NOT NULL,
+  consecutive_failures INTEGER DEFAULT 0 NOT NULL,
   active_widget_layouts VARCHAR2(1024) DEFAULT NULL,
+  display_name VARCHAR2(255) NOT NULL,
+  local_username VARCHAR2(255) NOT NULL,
+  create_time TIMESTAMP NULL,
   CONSTRAINT PK_users PRIMARY KEY (user_id),
   CONSTRAINT FK_users_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id),
-  CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type));
+  CONSTRAINT UNQ_users_0 UNIQUE (user_name));
+
+CREATE TABLE user_authentication (
+  user_authentication_id NUMBER(10),
+  user_id NUMBER(10) NOT NULL,
+  authentication_type VARCHAR(50) NOT NULL,
+  authentication_key BLOB,
+  create_time TIMESTAMP NULL,
+  update_time TIMESTAMP NULL,
+  CONSTRAINT PK_user_authentication PRIMARY KEY (user_authentication_id),
+  CONSTRAINT FK_user_authentication_users FOREIGN KEY (user_id) REFERENCES users(user_id)
+);
 
 CREATE TABLE groups (
   group_id NUMBER(10) NOT NULL,
@@ -1053,6 +1064,7 @@ CREATE INDEX idx_alert_notice_state on alert_notice(notify_state);
 -- In order for the first ID to be 1, must initialize the ambari_sequences table with a sequence_value of 0.
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('host_role_command_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('user_id_seq', 1);
+INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('user_authentication_id_seq', 1);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('group_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('member_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('cluster_id_seq', 0);
@@ -1142,8 +1154,14 @@ insert into adminprincipal (principal_id, principal_type_id)
   union all
   select 13, 8 from dual;
 
-insert into users(user_id, principal_id, user_name, user_password)
-select 1,1,'admin','538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00' from dual;
+-- Insert the default administrator user.
+insert into users(user_id, principal_id, user_name, display_name, local_username, create_timestamp)
+  SELECT 1, 1, 'admin', 'Administrator', 'admin', CURRENT_TIMESTAMP from dual;
+
+-- Insert the LOCAL authentication data for the default administrator user.
+-- The authentication_key value is the salted digest of the password: admin
+insert into user_authentication(user_authentication_id, user_id, authentication_type, authentication_key, create_time, update_time)
+  SELECT 1, 1, 'LOCAL', '538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP from dual;
 
 insert into adminpermission(permission_id, permission_name, resource_type_id, permission_label, principal_id, sort_order)
   select 1, 'AMBARI.ADMINISTRATOR', 1, 'Ambari Administrator', 7, 1 from dual

http://git-wip-us.apache.org/repos/asf/ambari/blob/7460cebf/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 49b956b..7a0e225 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -274,16 +274,27 @@ CREATE TABLE adminprincipal (
 CREATE TABLE users (
   user_id INTEGER,
   principal_id BIGINT NOT NULL,
-  ldap_user INTEGER NOT NULL DEFAULT 0,
   user_name VARCHAR(255) NOT NULL,
-  user_type VARCHAR(255) NOT NULL DEFAULT 'LOCAL',
-  create_time TIMESTAMP DEFAULT NOW(),
-  user_password VARCHAR(255),
   active INTEGER NOT NULL DEFAULT 1,
+  consecutive_failures INTEGER DEFAULT 0 NOT NULL,
   active_widget_layouts VARCHAR(1024) DEFAULT NULL,
+  display_name VARCHAR(255) NOT NULL,
+  local_username VARCHAR(255) NOT NULL,
+  create_time TIMESTAMP DEFAULT NOW(),
   CONSTRAINT PK_users PRIMARY KEY (user_id),
   CONSTRAINT FK_users_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id),
-  CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type));
+  CONSTRAINT UNQ_users_0 UNIQUE (user_name));
+
+CREATE TABLE user_authentication (
+  user_authentication_id INTEGER,
+  user_id INTEGER NOT NULL,
+  authentication_type VARCHAR(50) NOT NULL,
+  authentication_key BYTEA,
+  create_time TIMESTAMP DEFAULT NOW(),
+  update_time TIMESTAMP DEFAULT NOW(),
+  CONSTRAINT PK_user_authentication PRIMARY KEY (user_authentication_id),
+  CONSTRAINT FK_user_authentication_users FOREIGN KEY (user_id) REFERENCES users(user_id)
+);
 
 CREATE TABLE groups (
   group_id INTEGER,
@@ -1055,6 +1066,7 @@ INSERT INTO ambari_sequences (sequence_name, sequence_value) VALUES
   ('cluster_id_seq', 1),
   ('host_id_seq', 0),
   ('user_id_seq', 2),
+  ('user_authentication_id_seq', 2),
   ('group_id_seq', 1),
   ('member_id_seq', 1),
   ('host_role_command_id_seq', 1),
@@ -1130,8 +1142,14 @@ INSERT INTO adminprincipal (principal_id, principal_type_id) VALUES
   (12, 8),
   (13, 8);
 
-INSERT INTO Users (user_id, principal_id, user_name, user_password)
-  SELECT 1, 1, 'admin', '538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00';
+-- Insert the default administrator user.
+INSERT INTO users(user_id, principal_id, user_name, display_name, local_username, create_time)
+  SELECT 1, 1, 'admin', 'Administrator', 'admin', NOW();
+
+-- Insert the LOCAL authentication data for the default administrator user.
+-- The authentication_key value is the salted digest of the password: admin
+INSERT INTO user_authentication(user_authentication_id, user_id, authentication_type, authentication_key, create_time, update_time)
+  SELECT 1, 1, 'LOCAL', '538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00', NOW(), NOW();
 
 INSERT INTO adminpermission(permission_id, permission_name, resource_type_id, permission_label, principal_id, sort_order)
   SELECT 1, 'AMBARI.ADMINISTRATOR', 1, 'Ambari Administrator', 7, 1 UNION ALL

http://git-wip-us.apache.org/repos/asf/ambari/blob/7460cebf/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index c594a2e..f586a2b 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -273,16 +273,27 @@ CREATE TABLE adminprincipal (
 CREATE TABLE users (
   user_id INTEGER,
   principal_id NUMERIC(19) NOT NULL,
-  create_time TIMESTAMP DEFAULT NOW(),
-  ldap_user INTEGER NOT NULL DEFAULT 0,
   user_name VARCHAR(255) NOT NULL,
-  user_type VARCHAR(255) NOT NULL DEFAULT 'LOCAL',
-  user_password VARCHAR(255),
   active INTEGER NOT NULL DEFAULT 1,
+  consecutive_failures INTEGER DEFAULT 0 NOT NULL,
   active_widget_layouts VARCHAR(1024) DEFAULT NULL,
+  display_name VARCHAR(255) NOT NULL,
+  local_username VARCHAR(255) NOT NULL,
+  create_time TIMESTAMP DEFAULT NOW(),
   CONSTRAINT PK_users PRIMARY KEY (user_id),
   CONSTRAINT FK_users_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id),
-  CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type));
+  CONSTRAINT UNQ_users_0 UNIQUE (user_name));
+
+CREATE TABLE user_authentication (
+  user_authentication_id INTEGER,
+  user_id INTEGER NOT NULL,
+  authentication_type VARCHAR(50) NOT NULL,
+  authentication_key IMAGE,
+  create_time TIMESTAMP DEFAULT NOW(),
+  update_time TIMESTAMP DEFAULT NOW(),
+  CONSTRAINT PK_user_authentication PRIMARY KEY (user_authentication_id),
+  CONSTRAINT FK_user_authentication_users FOREIGN KEY (user_id) REFERENCES users(user_id)
+);
 
 CREATE TABLE groups (
   group_id INTEGER,
@@ -1054,6 +1065,7 @@ INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('cluster_id_
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('host_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('host_role_command_id_seq', 1);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('user_id_seq', 2);
+INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('user_authentication_id_seq', 2);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('group_id_seq', 1);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('member_id_seq', 1);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('configgroup_id_seq', 1);
@@ -1139,8 +1151,15 @@ insert into adminprincipal (principal_id, principal_type_id)
   union all
   select 13, 8;
 
-insert into users(user_id, principal_id, user_name, user_password)
-  select 1, 1, 'admin','538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00';
+-- Insert the default administrator user.
+insert into users(user_id, principal_id, user_name, display_name, local_username, create_time)
+  SELECT 1, 1, 'admin', 'Administrator', 'admin', NOW();
+
+-- Insert the LOCAL authentication data for the default administrator user.
+-- The authentication_key value is the salted digest of the password: admin
+insert into user_authentication(user_authentication_id, user_id, authentication_type, authentication_key, create_time, update_time)
+  SELECT 1, 1, 'LOCAL', '538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00', NOW(), NOW();
+
 
 insert into adminpermission(permission_id, permission_name, resource_type_id, permission_label, principal_id, sort_order)
   select 1, 'AMBARI.ADMINISTRATOR', 1, 'Ambari Administrator', 7, 1

http://git-wip-us.apache.org/repos/asf/ambari/blob/7460cebf/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index 77459a6..804bc60 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -279,16 +279,27 @@ CREATE TABLE adminprincipal (
 CREATE TABLE users (
   user_id INTEGER,
   principal_id BIGINT NOT NULL,
-  ldap_user INTEGER NOT NULL DEFAULT 0,
   user_name VARCHAR(255) NOT NULL,
-  user_type VARCHAR(255) NOT NULL DEFAULT 'LOCAL',
-  create_time DATETIME DEFAULT GETDATE(),
-  user_password VARCHAR(255),
   active INTEGER NOT NULL DEFAULT 1,
+  consecutive_failures INTEGER NOT NULL DEFAULT 0,
   active_widget_layouts VARCHAR(1024) DEFAULT NULL,
-  CONSTRAINT PK_users PRIMARY KEY CLUSTERED (user_id),
+  display_name VARCHAR(255) NOT NULL,
+  local_username VARCHAR(255) NOT NULL,
+  create_time DATETIME DEFAULT GETDATE(),
+  CONSTRAINT PK_users PRIMARY KEY (user_id),
   CONSTRAINT FK_users_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id),
-  CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type));
+  CONSTRAINT UNQ_users_0 UNIQUE (user_name));
+
+CREATE TABLE user_authentication (
+  user_authentication_id INTEGER,
+  user_id INTEGER NOT NULL,
+  authentication_type VARCHAR(50) NOT NULL,
+  authentication_key VARCHAR(max),
+  create_time DATETIME DEFAULT GETDATE(),
+  update_time DATETIME DEFAULT GETDATE(),
+  CONSTRAINT PK_user_authentication PRIMARY KEY (user_authentication_id),
+  CONSTRAINT FK_user_authentication_users FOREIGN KEY (user_id) REFERENCES users(user_id)
+);
 
 CREATE TABLE groups (
   group_id INTEGER,
@@ -1080,6 +1091,7 @@ BEGIN TRANSACTION
     ('cluster_id_seq', 1),
     ('host_id_seq', 0),
     ('user_id_seq', 2),
+    ('user_authentication_id_seq', 2),
     ('group_id_seq', 1),
     ('member_id_seq', 1),
     ('host_role_command_id_seq', 1),
@@ -1158,8 +1170,15 @@ BEGIN TRANSACTION
     (12, 8),
     (13, 8);
 
-  insert into users(user_id, principal_id, user_name, user_password)
-    select 1, 1, 'admin','538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00';
+  -- Insert the default administrator user.
+  insert into users(user_id, principal_id, user_name, display_name, local_username, create_time)
+    select 1, 1, 'admin', 'Administrator', 'admin', GETDATE();
+
+  -- Insert the LOCAL authentication data for the default administrator user.
+  -- The authentication_key value is the salted digest of the password: admin
+  insert into user_authentication(user_authentication_id, user_id, authentication_type, authentication_key, create_time, update_time)
+    select 1, 1, 'LOCAL', '538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00', GETDATE(), GETDATE();
+
 
   insert into adminpermission(permission_id, permission_name, resource_type_id, permission_label, principal_id, sort_order)
   values