From f6096c5ab7f05bf56c3d5634f80cb55f9b93f4d7 Mon Sep 17 00:00:00 2001 From: zihluwang Date: Tue, 27 Jan 2026 13:42:52 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A0=20API=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/authentication/folder.bru | 7 ++++++ api/authentication/login.bru | 23 +++++++++++++++++++ api/bruno.json | 9 ++++++++ api/collection.bru | 3 +++ api/environments/dev.bru | 3 +++ .../onixbyte/helix/service/AuthService.java | 12 +++------- 6 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 api/authentication/folder.bru create mode 100644 api/authentication/login.bru create mode 100644 api/bruno.json create mode 100644 api/collection.bru create mode 100644 api/environments/dev.bru diff --git a/api/authentication/folder.bru b/api/authentication/folder.bru new file mode 100644 index 0000000..e859f1f --- /dev/null +++ b/api/authentication/folder.bru @@ -0,0 +1,7 @@ +meta { + name: Authentication +} + +auth { + mode: none +} diff --git a/api/authentication/login.bru b/api/authentication/login.bru new file mode 100644 index 0000000..ea9a5b7 --- /dev/null +++ b/api/authentication/login.bru @@ -0,0 +1,23 @@ +meta { + name: Login + type: http + seq: 1 +} + +post { + url: {{BaseURL}}/auth/login + body: json + auth: inherit +} + +body:json { + { + "username": "helix", + "password": "123456" + } +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/api/bruno.json b/api/bruno.json new file mode 100644 index 0000000..d233235 --- /dev/null +++ b/api/bruno.json @@ -0,0 +1,9 @@ +{ + "version": "1", + "name": "Helix API", + "type": "collection", + "ignore": [ + "node_modules", + ".git" + ] +} \ No newline at end of file diff --git a/api/collection.bru b/api/collection.bru new file mode 100644 index 0000000..732ab0c --- /dev/null +++ b/api/collection.bru @@ -0,0 +1,3 @@ +auth { + mode: none +} diff --git a/api/environments/dev.bru b/api/environments/dev.bru new file mode 100644 index 0000000..3beeb49 --- /dev/null +++ b/api/environments/dev.bru @@ -0,0 +1,3 @@ +vars { + BaseURL: http://localhost:8080 +} diff --git a/src/main/java/com/onixbyte/helix/service/AuthService.java b/src/main/java/com/onixbyte/helix/service/AuthService.java index c36ae7f..fa71d9d 100644 --- a/src/main/java/com/onixbyte/helix/service/AuthService.java +++ b/src/main/java/com/onixbyte/helix/service/AuthService.java @@ -1,11 +1,9 @@ package com.onixbyte.helix.service; -import com.onixbyte.helix.client.TokenClient; import com.onixbyte.helix.domain.entity.Setting; import com.onixbyte.helix.domain.entity.User; import com.onixbyte.helix.domain.web.request.LoginRequest; import com.onixbyte.helix.exception.BizException; -import com.onixbyte.helix.manager.ApplicationManager; import com.onixbyte.helix.manager.CaptchaManager; import com.onixbyte.helix.manager.SecurityManager; import com.onixbyte.helix.manager.SettingManager; @@ -31,8 +29,6 @@ public class AuthService { private final CaptchaManager captchaManager; private final AuthenticationManager authenticationManager; private final SettingManager settingManager; - private final ApplicationManager applicationManager; - private final TokenClient tokenClient; private final SecurityManager securityManager; @Autowired @@ -40,13 +36,11 @@ public class AuthService { CaptchaManager captchaManager, AuthenticationManager authenticationManager, SettingManager settingManager, - ApplicationManager applicationManager, - TokenClient tokenClient, SecurityManager securityManager) { + SecurityManager securityManager + ) { this.captchaManager = captchaManager; this.authenticationManager = authenticationManager; this.settingManager = settingManager; - this.applicationManager = applicationManager; - this.tokenClient = tokenClient; this.securityManager = securityManager; } @@ -101,7 +95,7 @@ public class AuthService { public ResponseCookie buildCookie(String cookieName, String token) { var cookieBuilder = ResponseCookie.from(cookieName, token) .httpOnly(true) - .maxAge(securityManager.getTokenValidity()) + .maxAge(securityManager.getTokenValidDuration()) .path("/"); return cookieBuilder.build();