feat: Implement Oauth2 login log service and repository
- Added Oauth2LogLoginService for managing user authorization logs. - Implemented methods for inserting logs, cleaning logs, and exporting log data. - Created a new file for Oauth2 login log service. refactor: Remove unused open_api module - Deleted the open_api.go file as it was not utilized in the project. fix: Update error codes in SysProfileController - Changed error codes for binding errors and user authentication errors to more descriptive values. fix: Update cache handling in SysConfig and SysDictType services - Modified Redis set operations to include expiration time for cached values. refactor: Update middleware authorization checks - Replaced PreAuthorize middleware with AuthorizeUser across multiple routes in system and tool modules for consistency. chore: Clean up trace and ws modules - Updated middleware authorization in trace and ws modules to use AuthorizeUser.
This commit is contained in:
24
build/database/lite/install/oauth2_client.sql
Normal file
24
build/database/lite/install/oauth2_client.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- ----------------------------
|
||||
-- Table structure for oauth2_client
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS "oauth2_client";
|
||||
CREATE TABLE "oauth2_client" (
|
||||
"id" integer NOT NULL,
|
||||
"client_id" text(32) NOT NULL,
|
||||
"client_secret" text(64) NOT NULL,
|
||||
"title" text(64),
|
||||
"ip_white" text(255),
|
||||
"del_flag" text(1),
|
||||
"login_ip" text(128),
|
||||
"login_time" integer,
|
||||
"create_by" text(64),
|
||||
"create_time" integer,
|
||||
"update_by" text(64),
|
||||
"update_time" integer,
|
||||
"remark" text(200),
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of oauth2_client
|
||||
-- ----------------------------
|
||||
20
build/database/lite/install/oauth2_log_login.sql
Normal file
20
build/database/lite/install/oauth2_log_login.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- ----------------------------
|
||||
-- Table structure for oauth2_log_login
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS "oauth2_log_login";
|
||||
CREATE TABLE "oauth2_log_login" (
|
||||
"id" integer NOT NULL,
|
||||
"client_id" text(32),
|
||||
"login_ip" text(128),
|
||||
"login_location" text(32),
|
||||
"browser" text(64),
|
||||
"os" text(64),
|
||||
"status_flag" text(1),
|
||||
"msg" text(255),
|
||||
"login_time" integer,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of oauth2_log_login
|
||||
-- ----------------------------
|
||||
@@ -613,7 +613,7 @@ INSERT INTO "sys_i18n" VALUES (543, 'dictData.cdr_sip_code.503', '服务不可
|
||||
INSERT INTO "sys_i18n" VALUES (544, 'dictData.cdr_sip_code.504', '服务器超时', 'Server Time Out');
|
||||
INSERT INTO "sys_i18n" VALUES (545, 'dictData.cdr_sip_code.603', '拒绝', 'Decline');
|
||||
INSERT INTO "sys_i18n" VALUES (546, 'dictData.cdr_sip_code.606', '不可接受', 'Not Acceptable');
|
||||
INSERT INTO "sys_i18n" VALUES (547, 'cache.name.user', '登录用户', 'Login User');
|
||||
INSERT INTO "sys_i18n" VALUES (547, 'cache.name.token', '用户令牌', 'User Token');
|
||||
INSERT INTO "sys_i18n" VALUES (548, 'cache.name.sys_config', '参数管理', 'Parameters Management');
|
||||
INSERT INTO "sys_i18n" VALUES (549, 'cache.name.sys_dict', '字典管理', 'Dictionary Management');
|
||||
INSERT INTO "sys_i18n" VALUES (550, 'cache.name.captcha_codes', '验证码', 'Captcha');
|
||||
@@ -708,6 +708,8 @@ View network element configuration backup records for downloading or importing c
|
||||
INSERT INTO "sys_i18n" VALUES (637, 'job.backup_export_table_sys_log_operate', '备份-操作日志表定期导出', 'Backup-Operation Log Table Periodic Export');
|
||||
INSERT INTO "sys_i18n" VALUES (638, 'job.backup_export_table_cdr_event_ims', '备份-语音话单表定期导出', 'Backup-Regular Export of voice bill forms');
|
||||
INSERT INTO "sys_i18n" VALUES (639, 'job.backup_export_table_cdr_event_smf', '备份-数据话单表定期导出', 'Backup-Regular Export of data sheet tables');
|
||||
INSERT INTO "sys_i18n" VALUES (640, 'cache.name.oauth2_codes', '客户端授权码', 'Oauth2 Client Code');
|
||||
INSERT INTO "sys_i18n" VALUES (641, 'cache.name.oauth2_devices', '客户端令牌', 'Oauth2 Token');
|
||||
INSERT INTO "sys_i18n" VALUES (644, 'menu.log.exportFile', '导出文件', 'Exported File');
|
||||
INSERT INTO "sys_i18n" VALUES (645, 'menu.perf.kpiCReport', '自定义指标数据', 'Custom Indicator Data');
|
||||
INSERT INTO "sys_i18n" VALUES (646, 'menu.trace.taskHLR', 'HLR 跟踪任务', 'HLR Trace Task');
|
||||
@@ -751,6 +753,7 @@ alertHours upcoming expiration reminder time');
|
||||
INSERT INTO "sys_i18n" VALUES (674, 'config.sys.user.passwdNotAllowedHistory', '用户管理-不允许使用最近密码次数', 'User Management-Not Allowed Recent Passwords');
|
||||
INSERT INTO "sys_i18n" VALUES (675, 'config.sys.user.passwdNotAllowedHistoryRemark', '创建新密码不等于之前使用的x次中的密码', 'Creating a new password that is not equal to the previously used password in x times');
|
||||
INSERT INTO "sys_i18n" VALUES (676, 'login.errPasswdHistory', '不允许使用最近密码', 'Recent passwords not allowed');
|
||||
INSERT INTO "sys_i18n" VALUES (677, 'log.operate.title.oauth2client', 'Oauth2客户端授权', 'Oauth2 Client Authorization');
|
||||
INSERT INTO "sys_i18n" VALUES (679, 'dictType.trace_msg_type', '跟踪消息类型', 'Trace Message Type');
|
||||
INSERT INTO "sys_i18n" VALUES (680, 'dictData.trace_msg_type.0', '请求', 'Request');
|
||||
INSERT INTO "sys_i18n" VALUES (681, 'dictData.trace_msg_type.1', '响应', 'Response');
|
||||
|
||||
27
build/database/std/install/oauth2_client.sql
Normal file
27
build/database/std/install/oauth2_client.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for oauth2_client
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `oauth2_client`;
|
||||
CREATE TABLE `oauth2_client` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '应用ID',
|
||||
`client_id` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '应用的唯一标识',
|
||||
`client_secret` varchar(64) COLLATE utf8mb4_general_ci NOT NULL COMMENT '应用的凭证秘钥',
|
||||
`title` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '应用名称',
|
||||
`ip_white` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'IP白名单',
|
||||
`del_flag` varchar(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记(0存在 1删除)',
|
||||
`login_ip` varchar(128) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '最后登录IP',
|
||||
`login_time` bigint DEFAULT '0' COMMENT '最后登录时间',
|
||||
`create_by` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` bigint DEFAULT '0' COMMENT '创建时间',
|
||||
`update_by` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` bigint DEFAULT '0' COMMENT '更新时间',
|
||||
`remark` varchar(200) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '备注',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='第三方_用户授权应用表';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
-- Dump completed on 2025-04-25 15:26:56
|
||||
23
build/database/std/install/oauth2_log_login.sql
Normal file
23
build/database/std/install/oauth2_log_login.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for oauth2_log_login
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `oauth2_log_login`;
|
||||
CREATE TABLE `oauth2_log_login` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '登录ID',
|
||||
`client_id` varchar(32) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '应用的唯一标识',
|
||||
`login_ip` varchar(128) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '登录IP地址',
|
||||
`login_location` varchar(32) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '登录地点',
|
||||
`browser` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '浏览器类型',
|
||||
`os` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '操作系统',
|
||||
`status_flag` varchar(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '登录状态(0失败 1成功)',
|
||||
`msg` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '提示消息',
|
||||
`login_time` bigint DEFAULT '0' COMMENT '登录时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='第三方_用户授权应用登录日志表';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
-- Dump completed on 2025-04-25 15:26:56
|
||||
@@ -561,7 +561,7 @@ INSERT INTO `sys_i18n` VALUES (543, 'dictData.cdr_sip_code.503', '服务不可
|
||||
INSERT INTO `sys_i18n` VALUES (544, 'dictData.cdr_sip_code.504', '服务器超时', 'Server Time Out');
|
||||
INSERT INTO `sys_i18n` VALUES (545, 'dictData.cdr_sip_code.603', '拒绝', 'Decline');
|
||||
INSERT INTO `sys_i18n` VALUES (546, 'dictData.cdr_sip_code.606', '不可接受', 'Not Acceptable');
|
||||
INSERT INTO `sys_i18n` VALUES (547, 'cache.name.user', '登录用户', 'Login User');
|
||||
INSERT INTO `sys_i18n` VALUES (547, 'cache.name.token', '用户令牌', 'User Token');
|
||||
INSERT INTO `sys_i18n` VALUES (548, 'cache.name.sys_config', '参数管理', 'Parameters Management');
|
||||
INSERT INTO `sys_i18n` VALUES (549, 'cache.name.sys_dict', '字典管理', 'Dictionary Management');
|
||||
INSERT INTO `sys_i18n` VALUES (550, 'cache.name.captcha_codes', '验证码', 'Captcha');
|
||||
@@ -654,8 +654,8 @@ INSERT INTO `sys_i18n` VALUES (636, 'job.ne_config_backup_remark', '网元配置
|
||||
INSERT INTO `sys_i18n` VALUES (637, 'job.backup_export_table_sys_log_operate', '备份-操作日志表定期导出', 'Backup-Operation Log Table Periodic Export');
|
||||
INSERT INTO `sys_i18n` VALUES (638, 'job.backup_export_table_cdr_event_ims', '备份-语音话单表定期导出', 'Backup-Regular Export of voice bill forms');
|
||||
INSERT INTO `sys_i18n` VALUES (639, 'job.backup_export_table_cdr_event_smf', '备份-数据话单表定期导出', 'Backup-Regular Export of data sheet tables');
|
||||
-- INSERT INTO `sys_i18n` VALUES (640, 'table.sys_log_operate', '操作日志', 'Operation Log');
|
||||
-- INSERT INTO `sys_i18n` VALUES (641, 'table.cdr_event_ims', '语音话单', 'Voice CDR');
|
||||
INSERT INTO `sys_i18n` VALUES (640, 'cache.name.oauth2_codes', '客户端授权码', 'Oauth2 Client Code');
|
||||
INSERT INTO `sys_i18n` VALUES (641, 'cache.name.oauth2_devices', '客户端令牌', 'Oauth2 Token');
|
||||
-- INSERT INTO `sys_i18n` VALUES (642, 'table.cdr_event_smf', '数据话单', 'Data CDR');
|
||||
-- INSERT INTO `sys_i18n` VALUES (643, 'table.cdr_event_smsc', '短信话单', 'SMS CDR');
|
||||
INSERT INTO `sys_i18n` VALUES (644, 'menu.log.exportFile', '导出文件', 'Exported File');
|
||||
@@ -691,7 +691,7 @@ INSERT INTO `sys_i18n` VALUES (673, 'config.sys.user.passwdExpireRemark', '数
|
||||
INSERT INTO `sys_i18n` VALUES (674, 'config.sys.user.passwdNotAllowedHistory', '用户管理-不允许使用最近密码次数', 'User Management-Not Allowed Recent Passwords');
|
||||
INSERT INTO `sys_i18n` VALUES (675, 'config.sys.user.passwdNotAllowedHistoryRemark', '创建新密码不等于之前使用的x次中的密码', 'Creating a new password that is not equal to the previously used password in x times');
|
||||
INSERT INTO `sys_i18n` VALUES (676, 'login.errPasswdHistory', '不允许使用最近密码', 'Recent passwords not allowed');
|
||||
-- INSERT INTO `sys_i18n` VALUES (677, 'config.ne.neConfigBackupFTP', '配置文件备份FTP服务', 'NE Config Backup file FTP service');
|
||||
INSERT INTO `sys_i18n` VALUES (677, 'log.operate.title.oauth2client', 'Oauth2客户端授权', 'Oauth2 Client Authorization');
|
||||
-- INSERT INTO `sys_i18n` VALUES (678, 'config.ne.neConfigBackupFTPRemark', '请通过配置文件备份页面进行设置FTP信息', 'Please set the FTP information through the configuration file backup page.');
|
||||
INSERT INTO `sys_i18n` VALUES (679, 'dictType.trace_msg_type', '跟踪消息类型', 'Trace Message Type');
|
||||
INSERT INTO `sys_i18n` VALUES (680, 'dictData.trace_msg_type.0', '请求', 'Request');
|
||||
|
||||
Reference in New Issue
Block a user