Skip to content

Conversation

@nelsonmaia
Copy link
Contributor

🔧 Changes

This PR adds support for two new tenant-level session configuration fields to the Tenant resource:

  • ephemeral_session_lifetime
  • idle_ephemeral_session_lifetime

These fields allow customers to configure the absolute and idle timeouts for ephemeral (non-persistent) sessions.

Changes include:

  • Added fields to the Tenant struct in tenant.go
  • Updated MarshalJSON() to support _in_minutes behavior for values less than 1 hour (mirroring existing session fields)
  • Generated new getter/setter methods via make generate
  • Updated integration test (TestTenantManager) to validate read/write behavior of the new fields
  • Extended TestTenant_MarshalJSON to test marshaling logic for hour- and minute-based values
  • Regenerated test recordings to reflect changes

📚 References


🔬 Testing

  • Ran make test-record FILTER=TestTenantManager to verify update and read-back of new fields
  • Added assertions in the integration test for both ephemeral session fields
  • Verified MarshalJSON logic correctly routes values to *_in_minutes when below 1 hour
  • Deleted and regenerated test recording fixtures for consistency

📝 Checklist

  • All new/changed/fixed functionality is covered by tests
  • I have added documentation for all new/changed functionality (or N/A — will be documented in upstream product docs)

@nelsonmaia nelsonmaia requested a review from a team as a code owner October 2, 2025 14:43
@developerkunal developerkunal changed the base branch from main to v1 October 13, 2025 15:59
@developerkunal
Copy link
Contributor

Hi @nelsonmaia,

We shouldn’t add custom logic in SDKs, such as:

Updated MarshalJSON() to support _in_minutes behaviour for values less than 1 hour (mirroring existing session fields)

These changes will be lost in the generated SDK.

Currently, the SDK is just a wrapper on top of the API, so any custom logic should live in the API itself rather than the SDK.

@nelsonmaia
Copy link
Contributor Author

@developerkunal I just replicated the same behaviour for the GetIdleSessionLifetime and GetSessionLifetime, maybe my comment was confusing but I just used the same pattenr that the same fields have already

@developerkunal
Copy link
Contributor

@claude

@auth0 auth0 deleted a comment from github-actions bot Oct 29, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for ephemeral session lifetime settings in the Auth0 tenant management SDK. These new fields allow configuration of session timeouts for non-persistent sessions.

  • Adds EphemeralSessionLifetime and IdleEphemeralSessionLifetime fields to the Tenant struct
  • Implements custom marshaling logic to handle hour-to-minute conversion for values < 1
  • Updates test recordings and adds test coverage for the new fields

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
management/tenant.go Adds new ephemeral session lifetime fields and marshaling logic
management/tenant_test.go Adds test cases for ephemeral session lifetime fields and marshaling
management/management.gen.go Auto-generated getter methods for new fields
management/management.gen_test.go Auto-generated test coverage for new getter methods
test/data/recordings/TestTenantManager.yaml Updated test recordings with new API responses

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

assert.Equal(t, newTenantSettings.GetDefaultTokenQuota().GetOrganizations().GetClientCredentials(), actualTenantSettings.GetDefaultTokenQuota().GetOrganizations().GetClientCredentials())
assert.Equal(t, newTenantSettings.GetEphemeralSessionLifetime(), actualTenantSettings.GetEphemeralSessionLifetime())
assert.Equal(t, newTenantSettings.GetIdleEphemeralSessionLifetime(), actualTenantSettings.GetIdleEphemeralSessionLifetime())
assert.Equal(t, actualTenantSettings.GetIdleEphemeralSessionLifetime(), 0.25) // rounded if necessary
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment 'rounded if necessary' is misleading. Based on line 37 where IdleEphemeralSessionLifetime is set to 0.25 and the marshaling logic that converts values < 1 to minutes (15 minutes in this case), the value should remain 0.25 hours when read back. The comment should clarify that this verifies the value is correctly preserved through the round-trip, not that rounding occurred.

Suggested change
assert.Equal(t, actualTenantSettings.GetIdleEphemeralSessionLifetime(), 0.25) // rounded if necessary
assert.Equal(t, actualTenantSettings.GetIdleEphemeralSessionLifetime(), 0.25) // verifies value is preserved through round-trip (should remain 0.25 hours)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants