feat: add jwtttlshort config key for session tokens

Adds ServiceJWTTTLShort (default 600s) to control the lifetime of
short-lived JWTs issued during token refresh. The existing jwtttl
and jwtttllong keys remain for session expiry and long sessions.
This commit is contained in:
kolaente 2026-02-25 09:33:32 +01:00
parent 04e60472b7
commit a6bdeb67b0
2 changed files with 7 additions and 0 deletions

View File

@ -18,6 +18,11 @@
"default_value": "2592000", "default_value": "2592000",
"comment": "The duration of the \"remember me\" time in seconds. When the login request is made with\nthe long param set, the token returned will be valid for this period.\nThe default is 2592000 seconds (30 Days)." "comment": "The duration of the \"remember me\" time in seconds. When the login request is made with\nthe long param set, the token returned will be valid for this period.\nThe default is 2592000 seconds (30 Days)."
}, },
{
"key": "jwtttlshort",
"default_value": "600",
"comment": "The duration of short-lived JWT tokens in seconds. These tokens are used together with\nrefresh tokens for session-based authentication.\nThe default is 600 seconds (10 minutes)."
},
{ {
"key": "interface", "key": "interface",
"default_value": ":3456", "default_value": ":3456",

View File

@ -44,6 +44,7 @@ const (
ServiceJWTSecret Key = `service.JWTSecret` ServiceJWTSecret Key = `service.JWTSecret`
ServiceJWTTTL Key = `service.jwtttl` ServiceJWTTTL Key = `service.jwtttl`
ServiceJWTTTLLong Key = `service.jwtttllong` ServiceJWTTTLLong Key = `service.jwtttllong`
ServiceJWTTTLShort Key = `service.jwtttlshort`
ServiceInterface Key = `service.interface` ServiceInterface Key = `service.interface`
ServiceUnixSocket Key = `service.unixsocket` ServiceUnixSocket Key = `service.unixsocket`
ServiceUnixSocketMode Key = `service.unixsocketmode` ServiceUnixSocketMode Key = `service.unixsocketmode`
@ -336,6 +337,7 @@ func InitDefaultConfig() {
ServiceJWTSecret.setDefault(random) ServiceJWTSecret.setDefault(random)
ServiceJWTTTL.setDefault(259200) // 72 hours ServiceJWTTTL.setDefault(259200) // 72 hours
ServiceJWTTTLLong.setDefault(2592000) // 30 days ServiceJWTTTLLong.setDefault(2592000) // 30 days
ServiceJWTTTLShort.setDefault(600) // 10 minutes
ServiceInterface.setDefault(":3456") ServiceInterface.setDefault(":3456")
ServiceUnixSocket.setDefault("") ServiceUnixSocket.setDefault("")
ServicePublicURL.setDefault("") ServicePublicURL.setDefault("")