Add /configs/agent API to manage tenant agent configuration#1143
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
👮 Files not reviewed due to content moderation or server errors (1)
📝 WalkthroughA detailed high-level summary could not be generated for this review. Here is an overview derived from the analyzed file changes:
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
`@components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/Constants.java`:
- Around line 224-232: The new agent configuration entries in the ErrorMessage
enum reuse existing error codes, causing duplicate CNF identifiers. Update
ERROR_CODE_AGENT_CONFIG_RETRIEVE, ERROR_CODE_AGENT_CONFIG_UPDATE, and
ERROR_CODE_AGENT_CONFIG_DELETE in Constants.ErrorMessage to use new unused
numeric codes that do not overlap with the consent mapping entries, keeping the
enum values unique and traceable.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2a328954-ec0b-4379-a044-1fdd7e502b09
⛔ Files ignored due to path filters (4)
components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/ConfigsApi.javais excluded by!**/gen/**components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/ConfigsApiService.javais excluded by!**/gen/**components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/model/AgentConfigPatch.javais excluded by!**/gen/**components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/gen/java/org/wso2/carbon/identity/api/server/configs/v1/model/AgentConfiguration.javais excluded by!**/gen/**
📒 Files selected for processing (6)
components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/ConfigsServiceHolder.javacomponents/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.common/src/main/java/org/wso2/carbon/identity/api/server/configs/common/Constants.javacomponents/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/core/ServerConfigManagementService.javacomponents/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/factories/ServerConfigManagementServiceFactory.javacomponents/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/java/org/wso2/carbon/identity/api/server/configs/v1/impl/ConfigsApiServiceImpl.javacomponents/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/resources/configs.yaml
|
PR builder started |
|
PR builder completed |
|
PR builder started |
|
@coderabbitai can you review this |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== ConfigsServiceHolder.java ==="
fd ConfigsServiceHolder.java --exec cat -n {}
echo "=== Constants.java (relevant section) ==="
fd Constants.java --path '*configs*' --exec grep -n "AGENT_CONFIG\|ERROR_CODE_AGENT" {} \;
echo "=== ServerConfigManagementService.java ==="
fd ServerConfigManagementService.java --exec cat -n {}Length of output: 14847 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== Constants.java ==="
fd Constants.java | grep configs | xargs grep -n "AGENT_CONFIG\|ERROR_CODE_AGENT"
echo "=== ServerConfigManagementService.java ==="
fd ServerConfigManagementService.java --exec cat -n {}
echo "=== ConfigsApiServiceImpl.java (agent methods) ==="
fd ConfigsApiServiceImpl.java --exec grep -n -A 20 "AgentConfiguration\|patchAgentConfiguration\|deleteAgentConfiguration" {}
echo "=== ServerConfigManagementServiceFactory.java ==="
fd ServerConfigManagementServiceFactory.java --exec cat -n {}Length of output: 169398 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== ServerConfigManagementServiceFactory.java ==="
fd ServerConfigManagementServiceFactory.java --exec cat -n {}
echo "=== Constants.java (full, agent + relevant regex/error area) ==="
fd Constants.java | grep configs | xargs sed -n '1,260p'
echo "=== AgentConfigPatch model ==="
fd AgentConfigPatch.java --exec cat -n {}
echo "=== AgentConfiguration model ==="
fd AgentConfiguration.java --exec cat -n {}
echo "=== configs.yaml agent section ==="
fd configs.yaml --exec grep -n -A 60 "agent:" {}Length of output: 33701
Unformatted In
Suggested fix — pass public AgentConfiguration getAgentConfiguration() {
String tenantDomain = ContextLoader.getTenantDomainFromContext();
AgentConfiguration agentConfiguration = new AgentConfiguration();
try {
AgentConfig agentConfig = agentConfigMgtService.getAgentConfig(tenantDomain);
return agentConfiguration.agentsExternallyManaged(agentConfig.isAgentsExternallyManaged());
} catch (AgentConfigMgtException e) {
throw handleAgentConfigException(e, Constants.ErrorMessage.ERROR_CODE_AGENT_CONFIG_RETRIEVE, tenantDomain);
}
}and similarly for both Note: I noticed the same Everything else — OSGi service wiring in |
|
PR builder completed |
|
PR builder started |
|
PR builder completed |
jenkins-is-staging
left a comment
There was a problem hiding this comment.
Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/28514916491
Fixed the issue reported by coderabbit. |
Purpose
Exposes a new server-configuration sub-resource,
/configs/agent, that lets a tenant administrator manage agent settings. This is the API-server counterpart to the agent-config management service on the OAuth side (AgentConfigMgtService), and backs the "agents externally managed" toggle used during the authorize / token flows.Related to: wso2/product-is#28110
What changed
New endpoints under
/configs/agent:GETgetAgentConfigurationPATCHpatchAgentConfiguration/agentsExternallyManaged).DELETEdeleteAgentConfigurationSupporting changes:
AgentConfigurationandAgentConfigPatch.ServerConfigManagementService—getAgentConfiguration/patchAgentConfiguration/deleteAgentConfiguration, delegating to the OAuthAgentConfigMgtService.ConfigsServiceHolder,Constants, andServerConfigManagementServiceFactory.ConfigsApi,ConfigsApiService) andconfigs.yamlspec updated.