Skip to content

Commit 022df7e

Browse files
authored
Merge pull request #24 from bwaidelich/feature/22-token-default-lifetime-configuration
Set default token defaultLifetime
2 parents 379c50c + 49b5e6c commit 022df7e

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

Configuration/Settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Flownative:
1616
token:
1717

1818
# default lifetime of new tokens in seconds
19-
defaultLifetime: ~
19+
defaultLifetime: 600 # 600 seconds = 10 minutes
2020
encryption:
2121

2222
# A base64-encoded random key, for example generated with ./flow oauth:generateencryptionkey

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,37 @@ authorization" request. Another example is the client credentials flow,
2626
where an access token is stored in the authorizations table which is
2727
needed for executing authorized requests to the respective service.
2828

29+
### Token lifetime
30+
31+
New Authorization tokens are created with a lifetime of 600 seconds
32+
(10 minutes) by default.
33+
The expiration date is updated during authentication if a different
34+
`expires` parameter is specified in the OAuth2 access token.
35+
36+
The default token lifetime and frequency of expired tokens to be removed
37+
automatically can be configured:
38+
39+
```yaml
40+
Flownative:
41+
OAuth2:
42+
Client:
43+
garbageCollection:
44+
# The probability in percent of a client shutdown triggering a garbage
45+
# collection which removes expired tokens.
46+
#
47+
# Examples:
48+
# 1 (would be a 1% chance to clean up)
49+
# 20 (would be a 20% chance to clean up)
50+
# 0.42 (would be a 0.42 % chance to clean up)
51+
probability: 1
52+
token:
53+
# default lifetime of new tokens in seconds
54+
defaultLifetime: 600
55+
```
56+
57+
Note: By setting the `defaultLifetime` to `null`, new tokens won't expire
58+
by default.
59+
2960
## Encryption
3061

3162
By default, access tokens are serialized and stored unencrypted in the

0 commit comments

Comments
 (0)