From aed3ed660b542d6d78ae73e90b1c65f4ceb0b601 Mon Sep 17 00:00:00 2001 From: lizw-2015 <1183409807@qq.com> Date: Fri, 20 Jun 2025 10:30:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(servo):=20=E9=9B=86=E6=88=90=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E6=A8=A1=E5=9D=97=E5=B9=B6=E9=85=8D=E7=BD=AE=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 build.gradle.kts 中添加 clever-security 依赖 - 在 application.yml 中配置安全相关路径和 token 设置 - 在 application-dev.yml 中启用安全模块并配置数据源 --- servo/build.gradle.kts | 2 +- servo/src/main/resources/application-dev.yml | 7 ++++++ servo/src/main/resources/application.yml | 36 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/servo/build.gradle.kts b/servo/build.gradle.kts index a22e49f..8f21f5c 100644 --- a/servo/build.gradle.kts +++ b/servo/build.gradle.kts @@ -14,7 +14,7 @@ dependencies { api("org.clever:clever-data-jdbc-meta") api("org.clever:clever-data-redis") api("org.clever:clever-web") - // api("org.clever:clever-security") + api("org.clever:clever-security") // api("org.clever:clever-task") // api("org.clever:clever-task-ext") api("org.clever:clever-js-graaljs") diff --git a/servo/src/main/resources/application-dev.yml b/servo/src/main/resources/application-dev.yml index df90526..1197f6f 100644 --- a/servo/src/main/resources/application-dev.yml +++ b/servo/src/main/resources/application-dev.yml @@ -65,3 +65,10 @@ web: locations: - './yvan-lcc-bench/servo/out/production/classes' #- './yvan-lcc-bench/servo/build/classes/java/main' + security: + enable: true + data-source: + jdbc-name: "default" + enable-redis: true + redis-name: "default" + redis-namespace: "yvan-lcc-bench" diff --git a/servo/src/main/resources/application.yml b/servo/src/main/resources/application.yml index 9da3e2d..e4f90e9 100644 --- a/servo/src/main/resources/application.yml +++ b/servo/src/main/resources/application.yml @@ -139,3 +139,39 @@ web: isolation: default timeout: -1 read-only: false + security: + ignore-paths: + - '/favicon.ico' + - '/dist/**' + - '/static/**' + - '/**/*.png' + - '/**/*.ico' + - '/**/*.js' + - '/**/*.css' + - '/**/*.html' + - '/**/*.ts' + - '/**/*.tsx' + - '/**/*.map' + - '/**/*.png' + - '/**/*.jpg' + - '/**/*.gif' + - '/**/*.ttf' + - '/**/*.woff' + - '/**/*.woff2' + - '/**/.git' + ignore-auth-paths: [ ] + ignore-auth-failed-paths: [ ] + current-user-path: '/current_user' + login: + paths: [ '/login' ] + post-only: true + allow-repeat-login: true + concurrent-login-count: 1 + allow-after-login: true + logout: + path: '/logout' + token: + secret-key: 'yvan-lcc-bench' + token-validity: 30d + jwt-token-name: 'authorization' + refresh-token-name: 'refresh-token'