Add support for Challenge questions resource type#50
Draft
RovinKYK wants to merge 20 commits intowso2-extensions:masterfrom
Draft
Add support for Challenge questions resource type#50RovinKYK wants to merge 20 commits intowso2-extensions:masterfrom
RovinKYK wants to merge 20 commits intowso2-extensions:masterfrom
Conversation
…existing resource management APIs
There was a problem hiding this comment.
Pull request overview
Adds new resource types and supporting utilities to IAM-CTL so challenge question sets (and related new resources like OIDC scopes and Roles) can be exported/imported between Identity Server environments with keyword replacement, filtering, and optional deletion, integrated into exportAll / importAll.
Changes:
- Introduces new resource implementations for
CHALLENGE_QUESTIONS,OIDC_SCOPES, andROLES, and wires them into bulk CLI commands using a shared processing order. - Adds multi-format serialization/deserialization utilities (YAML/JSON/XML), plus helpers for XML root-tag handling and array normalization.
- Adds new utilities for resource reference replacement and request-body preparation, and expands configs/constants to support the new resource types.
Reviewed changes
Copilot reviewed 40 out of 41 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| iamctl/tests/serializationUtils_test.go | Adds unit tests for XML root-tag helpers and array-field normalization. |
| iamctl/tests/resourceReferenceUtils_test.go | Adds unit tests for reference-mapping and ALL_ITEMS path expansion utilities. |
| iamctl/tests/keywordUtils_test.go | Minor test variable rename to align with updated keyword-processing code. |
| iamctl/pkg/utils/summaryUtils.go | Updates summary tracking APIs to use ResourceType and string keys consistently. |
| iamctl/pkg/utils/setup.go | Extends tool/keyword config structs to include OIDC scopes, roles, challenge questions. |
| iamctl/pkg/utils/serializationUtils.go | New multi-format Serialize/Deserialize + XML root-tag + array normalization utilities. |
| iamctl/pkg/utils/resourceReferenceUtils.go | New utilities for building identifier maps and replacing cross-resource references. |
| iamctl/pkg/utils/resourceProperties.go | Adds ResourceType.String() and updates resource-type exclusion logic to use it. |
| iamctl/pkg/utils/resourceOrder.go | Defines a canonical resource processing order for bulk operations. |
| iamctl/pkg/utils/keywordUtils.go | Refactors keyword processing to be format-aware and reuse new serialization utils. |
| iamctl/pkg/utils/init.go | Expands OAuth scope string to include permissions for new APIs. |
| iamctl/pkg/utils/constants.go | Introduces ResourceType + Format, adds new resource constants and metadata structures. |
| iamctl/pkg/utils/commonUtils.go | Adds helper for exported file paths and map key normalization. |
| iamctl/pkg/utils/apiUtils.go | Adds generic GET/POST/PUT/PATCH helpers and JSON request-body preparation. |
| iamctl/pkg/userStores/userStoreUtils.go | Switches YAML dependency to v3 and fixes spelling in error messages. |
| iamctl/pkg/userStores/import.go | Updates folder naming to use ResourceType.String(). |
| iamctl/pkg/userStores/export.go | Updates folder naming to use ResourceType.String(). |
| iamctl/pkg/roles/rolesUtils.go | New roles helpers: list roles, keyword mapping, and SCIM patch-body construction. |
| iamctl/pkg/roles/import.go | New roles import implementation (create/patch/delete handling). |
| iamctl/pkg/roles/export.go | New roles export implementation via GET + keyword processing + serialization. |
| iamctl/pkg/oidcScopes/oidcScopeUtils.go | New OIDC scope helpers: list scopes, keyword mapping, existence checks. |
| iamctl/pkg/oidcScopes/import.go | New OIDC scope import implementation (create/update/delete). |
| iamctl/pkg/oidcScopes/export.go | New OIDC scope export implementation via GET + keyword processing + serialization. |
| iamctl/pkg/identityProviders/import.go | Updates YAML dependency and folder naming to use ResourceType.String(). |
| iamctl/pkg/identityProviders/idpUtils.go | Fixes spelling in error messages (“retrieved”). |
| iamctl/pkg/identityProviders/export.go | Updates folder naming to use ResourceType.String(). |
| iamctl/pkg/claims/import.go | Updates YAML dependency and folder naming to use ResourceType.String(). |
| iamctl/pkg/claims/export.go | Updates folder naming to use ResourceType.String(). |
| iamctl/pkg/claims/claimUtils.go | Updates YAML dependency and fixes spelling in error messages (“retrieved”). |
| iamctl/pkg/challengeQuestions/import.go | New challenge question set import implementation (create/update/delete). |
| iamctl/pkg/challengeQuestions/export.go | New challenge question set export implementation via GET + keyword processing + serialization. |
| iamctl/pkg/challengeQuestions/challengeQuestionUtils.go | New challenge question set helpers (list sets, keyword mapping, update body). |
| iamctl/pkg/applications/import.go | Updates YAML dependency and folder naming to use ResourceType.String(). |
| iamctl/pkg/applications/export.go | Updates folder naming to use ResourceType.String(). |
| iamctl/pkg/applications/applicationUtils.go | Updates YAML dependency and fixes spelling in error messages (“retrieved”). |
| iamctl/go.sum | Adds mxj + yaml.v3 sums and updates dependency set. |
| iamctl/go.mod | Adds mxj and yaml.v3 requirements. |
| iamctl/cmd/cli/importAll.go | Refactors bulk import to iterate utils.ResourceOrder and include new resource types. |
| iamctl/cmd/cli/exportAll.go | Refactors bulk export to iterate utils.ResourceOrder and include new resource types. |
| docs/cli-mode.md | Updates docs to mention OIDC scopes and fixes JSON example formatting. |
| README.md | Updates required scopes and supported resource types list to mention OIDC scopes. |
Comments suppressed due to low confidence (1)
README.md:94
- The supported resource types lists are missing Roles and Challenge Questions, which are introduced in this PR. Please add them (and clarify root vs sub-organization support if it differs).
The supported resource types to transfer resources between root organizations are:
* Applications
* Identity Providers
* Claims
* User Stores
* OIDC Scopes
The supported resource types to transfer resources between sub organizations are:
* Applications
* Identity Providers
* User Stores
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Add support for challenge question management in the IAM-CTL tool to enable export and import of challenge question sets between Identity Server environments.
Related to https://github.com/wso2-enterprise/iam-product-management/issues/662
Goals
Enable users to:
Approach
pkg/challengeQuestionspackage following existing resource type patternquestionsarray, not the full set.exportAllandimportAllCLI commandsCHALLENGE_QUESTIONSresource type to configuration system (constants, array identifiers, XML root tag, array field paths, tool/keyword configs)User Stories
As a system administrator, I want to export and import challenge question sets across environments to enable version control and maintain consistent IAM configurations.
Release Note
Added challenge question set management support to IAM-CTL tool.
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning