@@ -242,11 +242,29 @@ func ParseSSHConfigOption(opt string) (key string, value string, err error) {
242
242
return opt [:idx ], opt [idx + 1 :], nil
243
243
}
244
244
245
- // SessionLifetime should be any configuration related to creating apikeys and tokens.
245
+ // SessionLifetime refers to "sessions" authenticating into Coderd. Coder has
246
+ // multiple different session types: api keys, tokens, workspace app tokens,
247
+ // agent tokens, etc. This configuration struct should be used to group all
248
+ // settings referring to any of these session lifetime controls.
249
+ // TODO: These config options were created back when coder only had api keys.
250
+ // Today, the config is ambigously used for all of them. For example:
251
+ // - cli based api keys ignore all settings
252
+ // - login uses the default lifetime, not the MaxTokenLifetime
253
+ // - Tokens use the Default & MaxTokenLifetime
254
+ // - ... etc ...
255
+ // The rational behind each decision is undocumented. The naming behind these
256
+ // config options is also confusing without any clear documentation.
257
+ // 'CreateAPIKey' is used to make all sessions, and it's parameters are just
258
+ // 'LifetimeSeconds' and 'DefaultLifetime'. Which does not directly correlate to
259
+ // the config options here.
246
260
type SessionLifetime struct {
261
+ // DisableSessionExpiryRefresh will disable automatically refreshing api
262
+ // keys when they are used from the api. This means the api key lifetime at
263
+ // creation is the lifetime of the api key.
264
+ DisableSessionExpiryRefresh serpent.Bool `json:"disable_session_expiry_refresh,omitempty" typescript:",notnull"`
265
+
247
266
// DefaultSessionDuration is for api keys, not tokens.
248
- DefaultSessionDuration serpent.Duration `json:"max_session_expiry" typescript:",notnull"`
249
- DisableSessionExpiryRefresh serpent.Bool `json:"disable_session_expiry_refresh,omitempty" typescript:",notnull"`
267
+ DefaultSessionDuration serpent.Duration `json:"max_session_expiry" typescript:",notnull"`
250
268
251
269
MaxTokenLifetime serpent.Duration `json:"max_token_lifetime,omitempty" typescript:",notnull"`
252
270
}
0 commit comments