feat: add backdoor login functionality for testing environment

- Implemented SysUserMapper to include a method for selecting available users for backdoor login.
- Created XML mappings for the new backdoor user selection query.
- Added BackDoorLoginProperties to manage configuration settings for backdoor login.
- Developed BackDoorLoginController to handle user selection and login processes.
- Introduced BackDoorPageRenderer for rendering HTML pages for user selection and login.
- Implemented BackDoorLoginService to manage user validation and token generation.
- Added HTML templates for user selection, login, and error handling.
- Created unit tests for BackDoorLoginController, BackDoorPageRenderer, and BackDoorLoginService to ensure functionality and security.
- Documented usage and configuration in test-backdoor-login.md.
This commit is contained in:
2026-07-20 18:39:19 +08:00
parent 23743ff261
commit de42645cae
16 changed files with 1120 additions and 1 deletions

View File

@@ -0,0 +1,136 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="robots" content="noindex,nofollow,noarchive">
<link rel="icon" href="data:,">
<title>测试用户登录</title>
<style>
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
padding: 40px 20px;
color: #1f2937;
background: linear-gradient(145deg, #eef4ff 0%, #f7f9fc 48%, #eef7f4 100%);
font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.panel {
width: min(1120px, 100%);
margin: 0 auto;
overflow: hidden;
border: 1px solid rgba(15, 23, 42, .08);
border-radius: 18px;
background: rgba(255, 255, 255, .96);
box-shadow: 0 22px 55px rgba(31, 41, 55, .10);
}
header { padding: 28px 30px 22px; border-bottom: 1px solid #edf0f5; }
h1 { margin: 0; color: #111827; font-size: 24px; line-height: 1.35; }
.subtitle { margin: 8px 0 0; color: #6b7280; }
.warning {
margin-top: 18px;
padding: 10px 13px;
border: 1px solid #f5d995;
border-radius: 9px;
color: #7c4a03;
background: #fff9e8;
}
.toolbar {
display: flex;
gap: 10px;
align-items: center;
justify-content: space-between;
padding: 18px 30px;
border-bottom: 1px solid #edf0f5;
}
form { display: flex; flex: 1; max-width: 620px; gap: 9px; }
input {
min-width: 0;
flex: 1;
height: 40px;
padding: 0 13px;
border: 1px solid #cfd6e4;
border-radius: 8px;
outline: none;
font: inherit;
}
input:focus { border-color: #3178c6; box-shadow: 0 0 0 3px rgba(49, 120, 198, .12); }
button {
height: 40px;
padding: 0 20px;
border: 0;
border-radius: 8px;
color: #fff;
background: #2563a9;
cursor: pointer;
font-family: inherit;
font-size: 14px;
font-weight: 600;
line-height: 40px;
}
.count { flex: none; color: #6b7280; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #edf0f5; text-align: left; white-space: nowrap; }
th { color: #667085; background: #fafbfc; font-size: 13px; font-weight: 600; }
tbody tr:hover { background: #f8fbff; }
td.id { color: #667085; font-variant-numeric: tabular-nums; }
td.action { text-align: right; }
td.action a {
display: inline-block;
padding: 7px 13px;
border-radius: 7px;
color: #fff;
background: #1677ff;
text-decoration: none;
font-weight: 600;
}
td.action a:hover { background: #0958d9; }
.kind { color: #344054; }
small { color: #98a2b3; }
.empty { height: 150px; color: #98a2b3; text-align: center; }
footer { padding: 16px 30px 20px; color: #98a2b3; font-size: 12px; }
@media (max-width: 700px) {
body { padding: 14px 10px; }
header, .toolbar { padding-left: 18px; padding-right: 18px; }
.toolbar { align-items: stretch; flex-direction: column; }
form { max-width: none; }
.count { align-self: flex-end; }
}
</style>
</head>
<body>
<main class="panel">
<header>
<h1>选择一个 PC 用户登录</h1>
<p class="subtitle">点击用户后将跳过外部单点登录,并以该用户身份进入石河子智慧就业服务系统。</p>
<div class="warning">仅限测试环境使用。登录行为会写入审计记录,请勿在生产环境开启此入口。</div>
</header>
<section class="toolbar">
<form method="get">
<input name="keyword" value="@@KEYWORD@@" maxlength="50" autocomplete="off"
placeholder="输入用户 ID、账号、姓名或手机号搜索">
<button type="submit">搜索用户</button>
</form>
<div class="count">当前 @@COUNT@@ 条,最多显示 @@MAX_USERS@@ 条</div>
</section>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>用户 ID</th>
<th>账号</th>
<th>姓名</th>
<th>手机号</th>
<th>用户来源 / 部门</th>
<th></th>
</tr>
</thead>
<tbody>@@ROWS@@</tbody>
</table>
</div>
<footer>如列表中没有目标账号,请使用上方搜索框;停用和已删除账号不会显示。</footer>
</main>
</body>
</html>