docs: 添加 API docs
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
meta {
|
||||||
|
name: Authentication
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: none
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"version": "1",
|
||||||
|
"name": "Helix API",
|
||||||
|
"type": "collection",
|
||||||
|
"ignore": [
|
||||||
|
"node_modules",
|
||||||
|
".git"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
auth {
|
||||||
|
mode: none
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
vars {
|
||||||
|
BaseURL: http://localhost:8080
|
||||||
|
}
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
package com.onixbyte.helix.service;
|
package com.onixbyte.helix.service;
|
||||||
|
|
||||||
import com.onixbyte.helix.client.TokenClient;
|
|
||||||
import com.onixbyte.helix.domain.entity.Setting;
|
import com.onixbyte.helix.domain.entity.Setting;
|
||||||
import com.onixbyte.helix.domain.entity.User;
|
import com.onixbyte.helix.domain.entity.User;
|
||||||
import com.onixbyte.helix.domain.web.request.LoginRequest;
|
import com.onixbyte.helix.domain.web.request.LoginRequest;
|
||||||
import com.onixbyte.helix.exception.BizException;
|
import com.onixbyte.helix.exception.BizException;
|
||||||
import com.onixbyte.helix.manager.ApplicationManager;
|
|
||||||
import com.onixbyte.helix.manager.CaptchaManager;
|
import com.onixbyte.helix.manager.CaptchaManager;
|
||||||
import com.onixbyte.helix.manager.SecurityManager;
|
import com.onixbyte.helix.manager.SecurityManager;
|
||||||
import com.onixbyte.helix.manager.SettingManager;
|
import com.onixbyte.helix.manager.SettingManager;
|
||||||
@@ -31,8 +29,6 @@ public class AuthService {
|
|||||||
private final CaptchaManager captchaManager;
|
private final CaptchaManager captchaManager;
|
||||||
private final AuthenticationManager authenticationManager;
|
private final AuthenticationManager authenticationManager;
|
||||||
private final SettingManager settingManager;
|
private final SettingManager settingManager;
|
||||||
private final ApplicationManager applicationManager;
|
|
||||||
private final TokenClient tokenClient;
|
|
||||||
private final SecurityManager securityManager;
|
private final SecurityManager securityManager;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -40,13 +36,11 @@ public class AuthService {
|
|||||||
CaptchaManager captchaManager,
|
CaptchaManager captchaManager,
|
||||||
AuthenticationManager authenticationManager,
|
AuthenticationManager authenticationManager,
|
||||||
SettingManager settingManager,
|
SettingManager settingManager,
|
||||||
ApplicationManager applicationManager,
|
SecurityManager securityManager
|
||||||
TokenClient tokenClient, SecurityManager securityManager) {
|
) {
|
||||||
this.captchaManager = captchaManager;
|
this.captchaManager = captchaManager;
|
||||||
this.authenticationManager = authenticationManager;
|
this.authenticationManager = authenticationManager;
|
||||||
this.settingManager = settingManager;
|
this.settingManager = settingManager;
|
||||||
this.applicationManager = applicationManager;
|
|
||||||
this.tokenClient = tokenClient;
|
|
||||||
this.securityManager = securityManager;
|
this.securityManager = securityManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +95,7 @@ public class AuthService {
|
|||||||
public ResponseCookie buildCookie(String cookieName, String token) {
|
public ResponseCookie buildCookie(String cookieName, String token) {
|
||||||
var cookieBuilder = ResponseCookie.from(cookieName, token)
|
var cookieBuilder = ResponseCookie.from(cookieName, token)
|
||||||
.httpOnly(true)
|
.httpOnly(true)
|
||||||
.maxAge(securityManager.getTokenValidity())
|
.maxAge(securityManager.getTokenValidDuration())
|
||||||
.path("/");
|
.path("/");
|
||||||
|
|
||||||
return cookieBuilder.build();
|
return cookieBuilder.build();
|
||||||
|
|||||||
Reference in New Issue
Block a user