Add support for setting oauth token TTL
This commit is contained in:
Generated
+4
@@ -16,6 +16,8 @@ type (
|
||||
AuthOpt struct {
|
||||
LogEnabled bool `env:"AUTH_LOG_ENABLED"`
|
||||
Secret string `env:"AUTH_JWT_SECRET"`
|
||||
AccessTokenLifetime time.Duration `env:"AUTH_OAUTH2_ACCESS_TOKEN_LIFETIME"`
|
||||
RefreshTokenLifetime time.Duration `env:"AUTH_OAUTH2_REFRESH_TOKEN_LIFETIME"`
|
||||
Expiry time.Duration `env:"AUTH_JWT_EXPIRY"`
|
||||
ExternalRedirectURL string `env:"AUTH_EXTERNAL_REDIRECT_URL"`
|
||||
ExternalCookieSecret string `env:"AUTH_EXTERNAL_COOKIE_SECRET"`
|
||||
@@ -43,6 +45,8 @@ type (
|
||||
func Auth() (o *AuthOpt) {
|
||||
o = &AuthOpt{
|
||||
Secret: getSecretFromEnv("jwt secret"),
|
||||
AccessTokenLifetime: time.Hour * 2,
|
||||
RefreshTokenLifetime: time.Hour * 24 * 3,
|
||||
Expiry: time.Hour * 24 * 30,
|
||||
ExternalRedirectURL: fullURL("/auth/external/{provider}/callback"),
|
||||
ExternalCookieSecret: getSecretFromEnv("external cookie secret"),
|
||||
|
||||
@@ -22,6 +22,18 @@ props:
|
||||
Generated secret will change if you change any of these variables.
|
||||
====
|
||||
|
||||
- name: accessTokenLifetime
|
||||
type: time.Duration
|
||||
env: AUTH_OAUTH2_ACCESS_TOKEN_LIFETIME
|
||||
default: time.Hour * 2
|
||||
description: Access token lifetime
|
||||
|
||||
- name: refreshTokenLifetime
|
||||
type: time.Duration
|
||||
env: AUTH_OAUTH2_REFRESH_TOKEN_LIFETIME
|
||||
default: time.Hour * 24 * 3
|
||||
description: Refresh token lifetime
|
||||
|
||||
- name: expiry
|
||||
type: time.Duration
|
||||
env: AUTH_JWT_EXPIRY
|
||||
|
||||
Reference in New Issue
Block a user