Skip to content

Commit 92171b5

Browse files
committed
api: make AUTHENTICATION_TOKEN_TTL configurable
Don't add it to the workflows yet because ecamp#8025 will make this a lot easier. Has merge conflict with ecamp#8025 The ttl will be made shorter ones all users have refresh tokens.
1 parent a91e3c6 commit 92171b5

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

.helm/ecamp3/templates/api_configmap.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ metadata:
77
{{- include "app.commonLabels" . | nindent 4 }}
88
data:
99
ADDITIONAL_TRUSTED_HOSTS: {{ .Values.domain | quote }}
10+
{{- if not (.Values.api.authenticationTokenTtl | empty) }}
11+
AUTHENTICATION_TOKEN_TTL: {{ .Values.api.authenticationTokenTtl | quote }}
12+
{{- end }}
1013
COOKIE_PREFIX: {{ include "api.cookiePrefix" . | quote }}
1114
APP_ENV: {{ .Values.api.appEnv | quote }}
1215
APP_DEBUG: {{ .Values.api.appDebug | quote }}

.helm/ecamp3/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ featureToggle:
1818
checklist: false # enables checklist feature in frontend
1919

2020
api:
21+
authenticationTokenTtl:
2122
subpath: "/api"
2223
image:
2324
repository: "docker.io/ecamp/ecamp3-api"

api/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,6 @@ MAIL_FROM_NAME="eCamp v3"
8181
RECAPTCHA_SECRET="disabled"
8282
###< google/recaptcha ###
8383

84+
# Tokens are valid for 12 hours..
85+
AUTHENTICATION_TOKEN_TTL=43200
8486
TRANSLATE_ERRORS_TO_LOCALES="en,de,fr,it,rm"

api/config/packages/lexik_jwt_authentication.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ lexik_jwt_authentication:
77
public_key: '%env(resolve:JWT_PUBLIC_KEY)%'
88
pass_phrase: '%env(JWT_PASSPHRASE)%'
99

10-
# Tokens are valid for 12 hours, should be safe because we never expose the whole token to JavaScript.
11-
# Of course it would be even better to have only short-lived tokens but renew them on every request.
12-
token_ttl: 43200
10+
token_ttl: '%env(AUTHENTICATION_TOKEN_TTL)%'
1311

1412
# Read the JWT token from a split cookie: The [api-domain]_jwt_hp and [api-domain]_jwt_s cookies are combined with a period (.)
1513
# to form the full JWT token.

0 commit comments

Comments
 (0)