From 78f3e44839eb4d7137009de28948bdea0f5e23f0 Mon Sep 17 00:00:00 2001 From: "water.lyl" Date: Sun, 13 Jan 2019 20:39:35 +0800 Subject: [PATCH] Fix #381 update mysql user table and security ignore url --- config/src/main/resources/META-INF/nacos-db.sql | 17 ++++++++++++++++- config/src/main/resources/META-INF/schema.sql | 14 ++++++++++++++ .../resources/META-INF/nacos-default.properties | 4 +--- distribution/conf/nacos-mysql.sql | 15 +++++++++++++++ distribution/conf/schema.sql | 15 +++++++++++++++ test/src/test/resources/schema.sql | 14 ++++++++++++++ 6 files changed, 75 insertions(+), 4 deletions(-) diff --git a/config/src/main/resources/META-INF/nacos-db.sql b/config/src/main/resources/META-INF/nacos-db.sql index 0ccf886c0..3256dc270 100644 --- a/config/src/main/resources/META-INF/nacos-db.sql +++ b/config/src/main/resources/META-INF/nacos-db.sql @@ -176,4 +176,19 @@ CREATE TABLE `tenant_info` ( PRIMARY KEY (`id`), UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`), KEY `idx_tenant_id` (`tenant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info'; + +CREATE TABLE users ( + username varchar(50) NOT NULL PRIMARY KEY, + password varchar(500) NOT NULL, + enabled boolean NOT NULL +); + +CREATE TABLE roles ( + username varchar(50) NOT NULL, + role varchar(50) NOT NULL +); + +INSERT INTO users (username, password, enabled) VALUES ('admin', '$2a$10$HxtJtd59imujvbux.i55zOGewhnJiLVXX8D9AETDMV.XtBLDGOXtW', TRUE); + +INSERT INTO roles (username, role) VALUES ('admin', 'ROLE_ADMIN'); diff --git a/config/src/main/resources/META-INF/schema.sql b/config/src/main/resources/META-INF/schema.sql index ceabf32e4..b4240d34f 100644 --- a/config/src/main/resources/META-INF/schema.sql +++ b/config/src/main/resources/META-INF/schema.sql @@ -173,3 +173,17 @@ CREATE TABLE tenant_info ( CREATE INDEX tenant_info_tenant_id_idx ON tenant_info(tenant_id); +CREATE TABLE users ( + username varchar(50) NOT NULL PRIMARY KEY, + password varchar(500) NOT NULL, + enabled boolean NOT NULL +); + +CREATE TABLE roles ( + username varchar(50) NOT NULL, + role varchar(50) NOT NULL +); + +INSERT INTO users (username, password, enabled) VALUES ('admin', '$2a$10$HxtJtd59imujvbux.i55zOGewhnJiLVXX8D9AETDMV.XtBLDGOXtW', TRUE); + +INSERT INTO roles (username, role) VALUES ('admin', 'ROLE_ADMIN'); diff --git a/console/src/main/resources/META-INF/nacos-default.properties b/console/src/main/resources/META-INF/nacos-default.properties index 756f652b0..ab406a49f 100644 --- a/console/src/main/resources/META-INF/nacos-default.properties +++ b/console/src/main/resources/META-INF/nacos-default.properties @@ -45,6 +45,4 @@ db.password=4b9622f3f70c7677835ac5a6719e7caf #management.security=false #security.basic.enabled=false #nacos.security.ignore.urls=/** -nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/*,/v1/auth/login,/v1/auth/health - - +nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/*,/v1/auth/login,/v1/console/health,/v1/cs/**,/v1/ns/**,/v1/cmdb/** diff --git a/distribution/conf/nacos-mysql.sql b/distribution/conf/nacos-mysql.sql index 70f88f679..3256dc270 100644 --- a/distribution/conf/nacos-mysql.sql +++ b/distribution/conf/nacos-mysql.sql @@ -177,3 +177,18 @@ CREATE TABLE `tenant_info` ( UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`), KEY `idx_tenant_id` (`tenant_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info'; + +CREATE TABLE users ( + username varchar(50) NOT NULL PRIMARY KEY, + password varchar(500) NOT NULL, + enabled boolean NOT NULL +); + +CREATE TABLE roles ( + username varchar(50) NOT NULL, + role varchar(50) NOT NULL +); + +INSERT INTO users (username, password, enabled) VALUES ('admin', '$2a$10$HxtJtd59imujvbux.i55zOGewhnJiLVXX8D9AETDMV.XtBLDGOXtW', TRUE); + +INSERT INTO roles (username, role) VALUES ('admin', 'ROLE_ADMIN'); diff --git a/distribution/conf/schema.sql b/distribution/conf/schema.sql index 032bd4b81..e1dc888fd 100644 --- a/distribution/conf/schema.sql +++ b/distribution/conf/schema.sql @@ -171,3 +171,18 @@ CREATE TABLE tenant_info ( constraint tenant_info_id_key PRIMARY KEY (id), constraint uk_tenant_info_kptenantid UNIQUE (kp,tenant_id)); CREATE INDEX tenant_info_tenant_id_idx ON tenant_info(tenant_id); + +CREATE TABLE users ( + username varchar(50) NOT NULL PRIMARY KEY, + password varchar(500) NOT NULL, + enabled boolean NOT NULL +); + +CREATE TABLE roles ( + username varchar(50) NOT NULL, + role varchar(50) NOT NULL +); + +INSERT INTO users (username, password, enabled) VALUES ('admin', '$2a$10$HxtJtd59imujvbux.i55zOGewhnJiLVXX8D9AETDMV.XtBLDGOXtW', TRUE); + +INSERT INTO roles (username, role) VALUES ('admin', 'ROLE_ADMIN'); diff --git a/test/src/test/resources/schema.sql b/test/src/test/resources/schema.sql index ae4ae291b..aa014eae7 100644 --- a/test/src/test/resources/schema.sql +++ b/test/src/test/resources/schema.sql @@ -159,3 +159,17 @@ CREATE TABLE tenant_capacity ( constraint tenant_capacity_id_key PRIMARY KEY (id), constraint uk_tenant_id UNIQUE (tenant_id)); +CREATE TABLE users ( + username varchar(50) NOT NULL PRIMARY KEY, + password varchar(500) NOT NULL, + enabled boolean NOT NULL +); + +CREATE TABLE roles ( + username varchar(50) NOT NULL, + role varchar(50) NOT NULL +); + +INSERT INTO users (username, password, enabled) VALUES ('admin', '$2a$10$HxtJtd59imujvbux.i55zOGewhnJiLVXX8D9AETDMV.XtBLDGOXtW', TRUE); + +INSERT INTO roles (username, role) VALUES ('admin', 'ROLE_ADMIN');