diff --git a/src/main/java/com/example/scaffold/config/LearningProfileInfo.java b/src/main/java/com/example/scaffold/config/LearningProfileInfo.java index 4dad1f3..cd482f6 100644 --- a/src/main/java/com/example/scaffold/config/LearningProfileInfo.java +++ b/src/main/java/com/example/scaffold/config/LearningProfileInfo.java @@ -16,11 +16,15 @@ public class LearningProfileInfo { @Value("${app.enabled-modules:ioc,aop,mybatis,transaction,users}") private String[] enabledModules; + @Value("${auth.type:none}") + private String authType; + @GetMapping("/api/profile") public Map profileInfo() { return Map.of( "profile", activeProfile, - "enabledModules", Arrays.asList(enabledModules) + "enabledModules", Arrays.asList(enabledModules), + "authType", authType ); } } diff --git a/src/main/resources/application-advanced.yml b/src/main/resources/application-advanced.yml index 15f0542..7bc88d1 100644 --- a/src/main/resources/application-advanced.yml +++ b/src/main/resources/application-advanced.yml @@ -26,7 +26,7 @@ spring: # 鉴权方案选择: none / jwt / satoken auth: - type: ${AUTH_TYPE:none} # none | jwt | satoken + type: ${AUTH_TYPE:jwt} # none | jwt | satoken jwt: secret: ${JWT_SECRET:your-secret-key} expiration: ${JWT_EXPIRATION:86400000} # 24小时 diff --git a/src/main/resources/application-learn.yml b/src/main/resources/application-learn.yml index b9309f7..3a95fe0 100644 --- a/src/main/resources/application-learn.yml +++ b/src/main/resources/application-learn.yml @@ -15,6 +15,7 @@ app: auth: type: none + learning-note: "learn 模式默认不开启鉴权,专注 Spring 核心学习" cache: type: caffeine diff --git a/src/main/resources/static/api.html b/src/main/resources/static/api.html index fe2c43a..cf1dfc0 100644 --- a/src/main/resources/static/api.html +++ b/src/main/resources/static/api.html @@ -260,7 +260,7 @@ const res = await fetch('/api/profile'); const data = await res.json(); const enabled = (data.enabledModules || []).join(', '); - document.getElementById('profileBanner').textContent = `当前 profile: ${data.profile} | 已启用模块: ${enabled}`; + document.getElementById('profileBanner').textContent = `当前 profile: ${data.profile} | 鉴权模式: ${data.authType || 'none'} | 已启用模块: ${enabled}`; } catch (e) { document.getElementById('profileBanner').textContent = '当前 profile 读取失败,请检查 /api/profile'; } diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html index 7492a70..d1e5dfb 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/static/index.html @@ -80,6 +80,7 @@

🧪 实验任务卡(事务模块)

+

鉴权学习建议:learn=none(先学核心),advanced=jwt/satoken(再学安全链路)