Skip to content

Commit ef22d81

Browse files
authored
fixes #262 update openapi-security.yml to add jwtCacheFullSize (#263)
1 parent d31b0dd commit ef22d81

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

openapi-security/src/main/resources/config/openapi-security.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,20 @@ logJwtToken: ${openapi-security.logJwtToken:true}
4646
logClientUserScope: ${openapi-security.logClientUserScope:false}
4747

4848
# Enable JWT token cache to speed up verification. This will only verify expired time
49-
# and skip the signature verification as it takes more CPU power and long time.
49+
# and skip the signature verification as it takes more CPU power and a long time. If
50+
# each request has a different jwt token, like authorization code flow, this indicator
51+
# should be turned off. Otherwise, the cached jwt will only be removed after 15 minutes
52+
# and the cache can grow bigger if the number of requests is very high. This will cause
53+
# memory kill in a Kubernetes pod if the memory setting is limited.
5054
enableJwtCache: ${openapi-security.enableJwtCache:true}
5155

56+
# If enableJwtCache is true, then an error message will be shown up in the log if the
57+
# cache size is bigger than the jwtCacheFullSize. This helps the developers to detect
58+
# cache problem if many distinct tokens flood the cache in a short period of time. If
59+
# you see JWT cache exceeds the size limit in logs, you need to turn off the enableJwtCache
60+
# or increase the cache full size to a bigger number from the default 100.
61+
jwtCacheFullSize: ${openapi-security.jwtCacheFullSize:100}
62+
5263
# If you are using light-oauth2, then you don't need to have oauth subfolder for public
5364
# key certificate to verify JWT token, the key will be retrieved from key endpoint once
5465
# the first token is arrived. Default to false for dev environment without oauth2 server

openapi-security/src/test/resources/config/openapi-security.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,20 @@ logJwtToken: ${openapi-security.logJwtToken:true}
4040
logClientUserScope: ${openapi-security.logClientUserScope:false}
4141

4242
# Enable JWT token cache to speed up verification. This will only verify expired time
43-
# and skip the signature verification as it takes more CPU power and long time.
43+
# and skip the signature verification as it takes more CPU power and a long time. If
44+
# each request has a different jwt token, like authorization code flow, this indicator
45+
# should be turned off. Otherwise, the cached jwt will only be removed after 15 minutes
46+
# and the cache can grow bigger if the number of requests is very high. This will cause
47+
# memory kill in a Kubernetes pod if the memory setting is limited.
4448
enableJwtCache: ${openapi-security.enableJwtCache:true}
4549

50+
# If enableJwtCache is true, then an error message will be shown up in the log if the
51+
# cache size is bigger than the jwtCacheFullSize. This helps the developers to detect
52+
# cache problem if many distinct tokens flood the cache in a short period of time. If
53+
# you see JWT cache exceeds the size limit in logs, you need to turn off the enableJwtCache
54+
# or increase the cache full size to a bigger number from the default 100.
55+
jwtCacheFullSize: ${openapi-security.jwtCacheFullSize:100}
56+
4657
# If you are using light-oauth2, then you don't need to have oauth subfolder for public
4758
# key certificate to verify JWT token, the key will be retrieved from key endpoint once
4859
# the first token is arrived. Default to false for dev environment without oauth2 server

0 commit comments

Comments
 (0)