Skip to content

feat(tenant): add method for jit sso link generation#1530

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

feat(tenant): add method for jit sso link generation#1530
dorsha merged 2 commits into
mainfrom
shuni/task-20260513125221

Conversation

@dorsha
Copy link
Copy Markdown
Member

@dorsha dorsha commented May 13, 2026

Fixes descope/etc#15591

View workflow run

Perfect! I've successfully implemented the generate_sso_configuration_link method in the Python SDK, following the pattern from the Go SDK PR #457.

Summary of Changes

1. API Path Constant (descope/management/common.py)

  • Added tenant_generate_sso_configuration_link_path = "/v2/mgmt/tenant/adminlinks/sso/generate"

2. Method Implementation (descope/management/tenant.py)

  • Added generate_sso_configuration_link(tenant_id: str, expire_time: int) -> str
  • Parameters:
    • tenant_id: The tenant ID
    • expire_time: Expiration duration in seconds (e.g., 21600 for 6 hours)
  • Returns: The admin SSO configuration link as a string

3. Tests (tests/management/test_tenant.py)

  • test_generate_sso_configuration_link_success: Verifies successful link generation
  • test_generate_sso_configuration_link_failed: Verifies error handling

4. Documentation (README.md)

  • Added usage example in the "Manage Tenants" section

Quality Gate Results ✅

  • Format: ✅ All files properly formatted (ruff format)
  • Lint: ✅ All checks passed (ruff check)
  • Tests: ✅ 11/11 tests passed (including 2 new tests)

Implementation Details

  • Endpoint: POST /v2/mgmt/tenant/adminlinks/sso/generate
  • Request: {"tenantId": string, "expireTime": int}
  • Response: {"adminSSOConfigurationLink": string}

The implementation follows the exact pattern from the Go SDK and is consistent with existing Python SDK conventions. All tests pass and code quality checks are green! 🎉


Created by Shuni 🐕

Add new method to generate tenant admin self-service links for SSO
configuration, following the pattern from Go SDK PR #457.

- Add tenant_generate_sso_configuration_link_path constant to MgmtV1
- Implement generate_sso_configuration_link method in Tenant class
- Add comprehensive tests for success and failure scenarios
- Update README with usage example

The method generates a time-limited link that allows tenant admins to
configure SSO settings. The expireTime parameter is specified in
seconds (e.g., 21600 for 6 hours).

Endpoint: POST /v2/mgmt/tenant/adminlinks/sso/generate
Request: {"tenantId": string, "expireTime": int}
Response: {"adminSSOConfigurationLink": string}

Related: #457 (Go SDK), descope/etc#7560
@dorsha dorsha requested review from aviadl and Copilot May 13, 2026 12:57
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 tenant-management support for generating a JIT SSO configuration self-service admin link, exposing a new SDK method wired to the corresponding management API endpoint and documenting/test-driving the behavior.

Changes:

  • Added a new management API path constant for generating SSO configuration links.
  • Implemented Tenant.generate_sso_configuration_link(tenant_id, expire_time) -> str that POSTs the required payload and returns the generated link.
  • Added unit tests for success/failure flows and a README usage example.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
descope/management/common.py Adds the new mgmt endpoint path constant used by the tenant management client.
descope/management/tenant.py Introduces generate_sso_configuration_link that calls the new endpoint and returns the link from the response JSON.
tests/management/test_tenant.py Adds success/failure unit tests validating request shape and error handling.
README.md Documents how to call the new tenant SSO configuration link generator.

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

Comment thread descope/management/tenant.py
Comment thread README.md
@dorsha dorsha enabled auto-merge (squash) May 13, 2026 13:26
@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).

descope/management/common.py

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

@dorsha dorsha merged commit 463ff32 into main May 13, 2026
28 checks passed
@dorsha dorsha deleted the shuni/task-20260513125221 branch May 13, 2026 13:30
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