Skip to content

feat(tenant): add generate_sso_configuration_link to Tenant management#1534

Merged
dorsha merged 2 commits into
mainfrom
shuni/task-20260513141541
May 13, 2026
Merged

feat(tenant): add generate_sso_configuration_link to Tenant management#1534
dorsha merged 2 commits into
mainfrom
shuni/task-20260513141541

Conversation

@dorsha
Copy link
Copy Markdown
Member

@dorsha dorsha commented May 13, 2026

Fixes descope/etc#15591

View workflow run

Perfect! I've updated the implementation to include all the missing parameters from the API specification. Here's what was changed:

🎯 Changes Made

Updated Method: generate_sso_configuration_link

New signature with all API parameters:

def generate_sso_configuration_link(
    self,
    tenant_id: Optional[str] = None,
    expire_time: Optional[int] = None,
    email: Optional[str] = None,        # ← NEW
    sso_id: Optional[str] = None,       # ← NEW
) -> str:

Key Updates:

  1. Added Missing Parameters:

    • email - Email address associated with the admin
    • sso_id - SSO identifier for the tenant
  2. Made All Parameters Optional:

    • tenant_id - Now optional (per API docs)
    • expire_time - Now optional (per API docs)
  3. Enhanced Tests:

    • ✅ Test with all parameters
    • ✅ Test with minimal parameters (no args)
    • ✅ Test with original parameters (backward compatibility)
    • ✅ Test failure scenarios

📊 Quality Gate Results ✅

  • Format: ✅ Passed (no changes needed)
  • Lint: ✅ Passed (no issues)
  • Typecheck: ✅ Passed (mypy clean)
  • Tests: ✅ Passed (13/13 tenant tests, including 4 for this method)

💻 Usage Examples

from descope import DescopeClient

client = DescopeClient(project_id, management_key=mgmt_key)

# Minimal - all parameters optional
link = client.mgmt.tenant.generate_sso_configuration_link()

# With tenant and expiration
link = client.mgmt.tenant.generate_sso_configuration_link(
    tenant_id="tenant-123",
    expire_time=21600  # 6 hours
)

# With all parameters
link = client.mgmt.tenant.generate_sso_configuration_link(
    tenant_id="tenant-123",
    expire_time=21600,
    email="admin@example.com",
    sso_id="sso-456"
)

The implementation now fully matches the API specification! 🚀


Created by Shuni 🐕

Update the generate_sso_configuration_link method to include all optional
parameters from the API specification:
- Make tenant_id and expire_time optional (as per API docs)
- Add email parameter for admin email address
- Add sso_id parameter for SSO identifier

This ensures full compatibility with the /v2/mgmt/tenant/adminlinks/sso/generate
API endpoint as documented in the Descope API reference.

Changes:
- Update method signature to include all optional parameters
- Implement conditional parameter inclusion in request body
- Add comprehensive tests for all parameter combinations
- Add test for minimal parameters (no arguments)

Resolves: #0F83

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 13, 2026 14:19
Copy link
Copy Markdown
Contributor

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

Adds/updates the Tenant management API to generate a JIT SSO (admin self-service) configuration link with full optional parameter support, aligning the Python SDK surface with the management API spec.

Changes:

  • Updated Tenant.generate_sso_configuration_link to accept optional tenant_id, expire_time, email, and sso_id, and to only send provided fields.
  • Expanded tenant management tests to cover “all parameters” and “no parameters” request shapes.

Reviewed changes

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

File Description
descope/management/tenant.py Expands the SDK method signature and request body construction for SSO configuration link generation.
tests/management/test_tenant.py Adds unit tests validating request payloads for full and minimal parameter usage.

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

Comment thread descope/management/tenant.py Outdated
@github-actions
Copy link
Copy Markdown

Coverage report

The coverage rate went from 98.37% to 98.37% ⬆️

100% of new lines are covered.

Diff Coverage details (click to unfold)

descope/management/tenant.py

100% of new lines are covered (100% of the complete file).

@dorsha
Copy link
Copy Markdown
Member Author

dorsha commented May 13, 2026

@shuni tenant_id should not be optional, and also fix pr title

@shuni-bot
Copy link
Copy Markdown
Contributor

shuni-bot Bot commented May 13, 2026

🐕 Done! Updated PR: #1534

View workflow run

📋 Actions Taken

View AI response

Perfect! I've completed both requested changes:

✅ Changes Made

1. Made tenant_id Required

Changed the method signature from:

def generate_sso_configuration_link(
    self,
    tenant_id: Optional[str] = None,  # ❌ Was optional
    ...
)

To:

def generate_sso_configuration_link(
    self,
    tenant_id: str,  # ✅ Now required
    ...
)
  • Updated the docstring to reflect that tenant_id is required (not optional)
  • Updated the test test_generate_sso_configuration_link_minimal_params to pass a tenant_id
  • All 4 SSO configuration link tests pass ✅

2. Fixed PR Title

Changed from:

  • [FR][0F83] Add Python SDK Method for JIT SSO Link Generation

To:

  • feat: add generate_sso_configuration_link to Tenant management

The new title follows conventional commits format and accurately describes the feature.

📊 Quality Gate Results ✅

  • Format: ✅ Passed (ruff format - 2 files already formatted)
  • Lint: ✅ Passed (ruff check - all checks passed)
  • Typecheck: ✅ Passed (mypy - no type errors)
  • Tests: ✅ Passed (13/13 tenant tests, including all 4 SSO link tests)

💻 Updated Usage

# tenant_id is now required
link = client.mgmt.tenant.generate_sso_configuration_link(
    tenant_id="tenant-123",  # ← Required parameter
    expire_time=21600,        # Optional
    email="admin@example.com",  # Optional
    sso_id="sso-456"          # Optional
)

All changes have been committed and are ready for the PR! 🚀


View session on Shuni Portal 🐾

Make tenant_id a required parameter instead of optional, as it's
needed for the API to function correctly. Update test to pass
tenant_id when calling with minimal parameters.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@dorsha dorsha changed the title [FR][0F83] Add Python SDK Method for JIT SSO Link Generation feat: add generate_sso_configuration_link to Tenant management May 13, 2026
@dorsha dorsha changed the title feat: add generate_sso_configuration_link to Tenant management feat(tenant): add generate_sso_configuration_link to Tenant management May 13, 2026
@dorsha dorsha enabled auto-merge (squash) May 13, 2026 14:32
Comment thread descope/management/tenant.py
@dorsha dorsha merged commit b56a35d into main May 13, 2026
33 checks passed
@dorsha dorsha deleted the shuni/task-20260513141541 branch May 13, 2026 15:09
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.

3 participants