-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TT-11909]: Added Session Lifetime to OAS #6835
Conversation
API Changes --- prev.txt 2025-01-17 04:28:44.729677054 +0000
+++ current.txt 2025-01-17 04:28:40.248664381 +0000
@@ -246,6 +246,7 @@
CacheOptions CacheOptions `bson:"cache_options" json:"cache_options"`
SessionLifetimeRespectsKeyExpiration bool `bson:"session_lifetime_respects_key_expiration" json:"session_lifetime_respects_key_expiration,omitempty"`
SessionLifetime int64 `bson:"session_lifetime" json:"session_lifetime"`
+ SessionLifetimeDisabled bool `bson:"session_lifetime_disabled" json:"session_lifetime_disabled"`
Active bool `bson:"active" json:"active"`
Internal bool `bson:"internal" json:"internal"`
AuthProvider AuthProviderMeta `bson:"auth_provider" json:"auth_provider"`
@@ -2137,6 +2138,9 @@
// SecuritySchemes contains security schemes definitions.
SecuritySchemes SecuritySchemes `bson:"securitySchemes,omitempty" json:"securitySchemes,omitempty"`
+
+ // KeyRetentionPeriod contains configuration for key retention.
+ KeyRetentionPeriod *KeyRetentionPeriod `bson:"keyRetentionPeriod,omitempty" json:"keyRetentionPeriod,omitempty"`
}
Authentication contains configuration about the authentication methods and
security policies applied to requests.
@@ -3058,6 +3062,36 @@
func (j *JWTValidation) Fill(jwt apidef.JWTValidation)
+type KeyRetentionPeriod struct {
+ // Enabled enables Key retention for the API
+ //
+ // Tyk classic API definition: `disable_expire_analytics`.
+ Enabled bool `bson:"enabled,omitempty" json:"enabled,omitempty"`
+ // Value configures the expiry interval for a Key.
+ // The value is a string that specifies the interval in a compact form,
+ // where hours, minutes and seconds are denoted by 'h', 'm' and 's' respectively.
+ // Multiple units can be combined to represent the duration.
+ //
+ // Examples of valid shorthand notations:
+ // - "1h" : one hour
+ // - "20m" : twenty minutes
+ // - "30s" : thirty seconds
+ // - "1m29s": one minute and twenty-nine seconds
+ // - "1h30m" : one hour and thirty minutes
+ //
+ // An empty value is interpreted as "0s"
+ //
+ // Tyk classic API definition: `expire_analytics_after`.
+ Value ReadableDuration `bson:"value" json:"value"`
+}
+ KeyRetentionPeriod contains configuration for key retention.
+
+func (k *KeyRetentionPeriod) ExtractTo(api *apidef.APIDefinition)
+ ExtractTo extracts *Authentication into *apidef.APIDefinition.
+
+func (k *KeyRetentionPeriod) Fill(api apidef.APIDefinition)
+ Fill fills *KeyRetentionPeriod from apidef.APIDefinition.
+
type Kind = event.Kind
Kind is an alias maintained to be used in imports.
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
c0cdaa0
to
be967a9
Compare
Co-authored-by: Tit Petric <[email protected]>
Co-authored-by: Tit Petric <[email protected]>
Co-authored-by: Tit Petric <[email protected]>
Quality Gate passedIssues Measures |
User description
TT-11909
Description
TT-1909
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist
PR Type
Enhancement, Tests
Description
Added
session_lifetime_disabled
field to API definition.Introduced
KeyRetentionPeriod
struct for token TTL management.Updated OpenAPI schema to include
keyRetentionPeriod
.Enhanced migration and linter tests to cover new fields.
Changes walkthrough 📝
api_definitions.go
Introduced `session_lifetime_disabled` field
apidef/api_definitions.go
session_lifetime_disabled
field to API definition.migration.go
Updated migration logic for session lifetime
apidef/migration.go
SessionLifetimeDisabled
flag in migration logic.authentication.go
Introduced `KeyRetentionPeriod` for token TTL
apidef/oas/authentication.go
KeyRetentionPeriod
struct for token TTL management.Fill
andExtractTo
methods forKeyRetentionPeriod
.x-tyk-api-gateway.json
Updated OpenAPI schema for `keyRetentionPeriod`
apidef/oas/schema/x-tyk-api-gateway.json
keyRetentionPeriod
definition.keyRetentionPeriod
.schema.json
Updated schema with `session_lifetime_disabled`
apidef/schema.json
session_lifetime_disabled
field to schema.migration_test.go
Enhanced migration tests for session lifetime
apidef/migration_test.go
SessionLifetimeDisabled
flag.linter_test.go
Added linter test for `KeyRetentionPeriod`
apidef/oas/linter_test.go
KeyRetentionPeriod
.