Skip to content

Fix[Admin]: Connector Configuration disappearing issue when Key Manager type switch from Token Exchange type#1388

Open
ShavinAnjithaAlpha wants to merge 2 commits into
wso2:mainfrom
ShavinAnjithaAlpha:fix/4852-admin-key-manager-switch
Open

Fix[Admin]: Connector Configuration disappearing issue when Key Manager type switch from Token Exchange type#1388
ShavinAnjithaAlpha wants to merge 2 commits into
wso2:mainfrom
ShavinAnjithaAlpha:fix/4852-admin-key-manager-switch

Conversation

@ShavinAnjithaAlpha

Copy link
Copy Markdown
Contributor

Purpose

When adding a new Key Manager from the APIM Admin Portal and switching the Key Manager type back from the Token Exchange type, the Connector Configuration section disappears. This occurs because the setEnableDirectToken state variable is never restored to true.

This PR fixes the issue by resetting the setEnableDirectToken variable to true whenever the Key Manager type switches away from Token Exchange.

Fixes #4852

Issue Link

File Modified: AddEditKeyManager.jsx

…switch back from Token Exchange

In the Admin Portal, switching the Key Manager type back from Token Exchange causes
the connector configuration section to disappear because setEnableDirectToken is never reset to true.
This PR fixes the issue by restoring it to true during the type switch.

Fixes: 4852
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f5b75ecb-cd8e-4411-ac9a-28a43153dc99

📥 Commits

Reviewing files that changed from the base of the PR and between a243b38 and 6b27ca9.

📒 Files selected for processing (1)
  • portals/admin/src/main/webapp/source/src/app/components/KeyManagers/AddEditKeyManager.jsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • portals/admin/src/main/webapp/source/src/app/components/KeyManagers/AddEditKeyManager.jsx

📝 Walkthrough

Walkthrough

AddEditKeyManager.jsx now resets token mode state when the key manager type changes, while preserving the existing tokenExchange handling.

Changes

Key Manager token mode reset

Layer / File(s) Summary
Token mode reset logic and wiring
portals/admin/src/main/webapp/source/src/app/components/KeyManagers/AddEditKeyManager.jsx
updateKeyManagerConnectorConfiguration accepts a new shouldResetTokenMode flag that resets enableDirectToken/enableExchangeToken state, and the type field's onChange handler now passes true to trigger this reset when the key manager type changes.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: fixing the Connector Configuration issue when switching away from Token Exchange.
Description check ✅ Passed The description clearly describes the same Connector Configuration bug and the token-mode reset fix.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@portals/admin/src/main/webapp/source/src/app/components/KeyManagers/AddEditKeyManager.jsx`:
- Around line 287-294: The reset logic in updateKeyManagerConnectorConfiguration
is too broad because the type field’s onChange always passes
shouldResetTokenMode as true, so changing between non-tokenExchange types clears
enableExchangeToken unnecessarily. Update the type onChange flow in
AddEditKeyManager.jsx so the reset only happens when the previous key manager
type was tokenExchange, and keep the existing direct/exchange selections intact
for other type-to-type changes. Use the existing
updateKeyManagerConnectorConfiguration and the type onChange handler to gate the
reset based on the prior type state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 38889b26-fcb7-414c-8038-359d7bf59222

📥 Commits

Reviewing files that changed from the base of the PR and between 8721231 and a243b38.

📒 Files selected for processing (1)
  • portals/admin/src/main/webapp/source/src/app/components/KeyManagers/AddEditKeyManager.jsx

When invoking updateKeyManagerConnectorConfiguration, change the hardcoded true value
to dynamic so that only when the Key Manager type changes from Token Exchange to an another
value, setEnableDirectToken will be restored to true.

Fixes: #4852
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

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.

1 participant