(ctx context.Context, store *store.Store, licenseService *enterprise.LicenseService, workspaceID string)
| 41 | } |
| 42 | |
| 43 | func GetAccessTokenDuration(ctx context.Context, store *store.Store, licenseService *enterprise.LicenseService, workspaceID string) time.Duration { |
| 44 | accessTokenDuration := DefaultAccessTokenDuration |
| 45 | |
| 46 | // If the sign-in frequency control feature is not enabled, return default duration |
| 47 | if err := licenseService.IsFeatureEnabled(ctx, workspaceID, v1pb.PlanFeature_FEATURE_TOKEN_DURATION_CONTROL); err != nil { |
| 48 | return accessTokenDuration |
| 49 | } |
| 50 | |
| 51 | workspaceProfile, err := store.GetWorkspaceProfileSetting(ctx, workspaceID) |
| 52 | if err != nil { |
| 53 | return accessTokenDuration |
| 54 | } |
| 55 | |
| 56 | if workspaceProfile.GetAccessTokenDuration().GetSeconds() > 0 { |
| 57 | accessTokenDuration = workspaceProfile.GetAccessTokenDuration().AsDuration() |
| 58 | } |
| 59 | |
| 60 | return accessTokenDuration |
| 61 | } |
| 62 | |
| 63 | func GetRefreshTokenDuration(ctx context.Context, store *store.Store, licenseService *enterprise.LicenseService, workspaceID string) time.Duration { |
| 64 | refreshTokenDuration := DefaultRefreshTokenDuration |
no test coverage detected