Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.wso2.carbon.identity.cors.mgt.core.CORSManagementService;
import org.wso2.carbon.identity.fraud.detection.core.service.FraudDetectionConfigsService;
import org.wso2.carbon.identity.oauth.dcr.DCRConfigurationMgtService;
import org.wso2.carbon.identity.oauth2.agent.services.AgentConfigMgtService;
import org.wso2.carbon.identity.oauth2.config.services.OAuth2OIDCConfigOrgUsageScopeMgtService;
import org.wso2.carbon.identity.oauth2.impersonation.services.ImpersonationConfigMgtService;
import org.wso2.carbon.identity.oauth2.token.handler.clientauth.jwt.core.JWTClientAuthenticatorMgtService;
Expand Down Expand Up @@ -71,6 +72,12 @@ private static class ImpersonationConfigMgtServiceHolder {
.getThreadLocalCarbonContext().getOSGiService(ImpersonationConfigMgtService.class, null);
}

private static class AgentConfigMgtServiceHolder {

static final AgentConfigMgtService SERVICE = (AgentConfigMgtService) PrivilegedCarbonContext
.getThreadLocalCarbonContext().getOSGiService(AgentConfigMgtService.class, null);
}

private static class DCRConfigurationMgtServiceHolder {

static final DCRConfigurationMgtService SERVICE = (DCRConfigurationMgtService) PrivilegedCarbonContext
Expand Down Expand Up @@ -176,6 +183,16 @@ public static ImpersonationConfigMgtService getImpersonationConfigMgtService() {
return ImpersonationConfigMgtServiceHolder.SERVICE;
}

/**
* Get Agent Config Mgt osgi service.
*
* @return AgentConfigMgtService
*/
public static AgentConfigMgtService getAgentConfigMgtService() {

return AgentConfigMgtServiceHolder.SERVICE;
}

/**
* Get DCRConfigurationMgtService osgi service.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ private Constants() {
*/
public static final String IMPERSONATION_CONFIG_ENABLE_EMAIL_NOTIFICATION = "/enableEmailNotification";

/**
* PATCH operation path for Agent configuration.
*/
public static final String AGENT_CONFIG_AGENTS_EXTERNALLY_MANAGED = "/agentsExternallyManaged";

/**
* PATCH operation paths for DCR configuration.
*/
Expand Down Expand Up @@ -216,6 +221,15 @@ public enum ErrorMessage {
ERROR_CODE_IMP_CONFIG_DELETE("65022",
"Unable to delete Impersonation configuration.",
"Server encountered an error while deleting the Impersonation configuration of %s."),
ERROR_CODE_AGENT_CONFIG_RETRIEVE("65036",
"Unable to retrieve Agent configuration.",
"Server encountered an error while retrieving the Agent configuration of %s."),
ERROR_CODE_AGENT_CONFIG_UPDATE("65037",
"Unable to update Agent configuration.",
"Server encountered an error while updating the Agent configuration of %s."),
ERROR_CODE_AGENT_CONFIG_DELETE("65038",
"Unable to delete Agent configuration.",
"Server encountered an error while deleting the Agent configuration of %s."),

ERROR_CODE_FRAUD_DETECTION_CONFIG_RETRIEVE("65023",
"Unable to retrieve Fraud Detection configuration.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import org.wso2.carbon.identity.api.server.configs.v1.model.DCRConfig;
import org.wso2.carbon.identity.api.server.configs.v1.model.DCRPatch;
import org.wso2.carbon.identity.api.server.configs.v1.model.Error;
import org.wso2.carbon.identity.api.server.configs.v1.model.AgentConfiguration;
import org.wso2.carbon.identity.api.server.configs.v1.model.AgentConfigPatch;
import org.wso2.carbon.identity.api.server.configs.v1.model.FraudDetectionConfig;
import org.wso2.carbon.identity.api.server.configs.v1.model.ImpersonationConfiguration;
import org.wso2.carbon.identity.api.server.configs.v1.model.ImpersonationPatch;
Expand Down Expand Up @@ -332,6 +334,30 @@ public Response getImpersonationConfiguration() {
return delegate.getImpersonationConfiguration();
}

@Valid
@GET
@Path("/agent")

@Produces({ "application/json" })
@ApiOperation(value = "Retrieve the tenant agent configuration.", notes = "Retrieve the tenant agent configuration.", response = AgentConfiguration.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Agent Configurations", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful Response", response = AgentConfiguration.class),
@ApiResponse(code = 400, message = "Bad Request", response = Error.class),
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response getAgentConfiguration() {

return delegate.getAgentConfiguration();
}

@Valid
@GET
@Path("/provisioning/inbound/scim")
Expand Down Expand Up @@ -693,6 +719,30 @@ public Response patchImpersonationConfiguration(@ApiParam(value = "" ,required=t
return delegate.patchImpersonationConfiguration(impersonationPatch );
}

@Valid
@PATCH
@Path("/agent")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "Patch the tenant agent configuration.", notes = "Patch the tenant agent configuration. A JSONPatch as defined by RFC 6902.", response = Void.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Agent Configurations", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successful Response", response = Void.class),
@ApiResponse(code = 400, message = "Bad Request", response = Error.class),
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
@ApiResponse(code = 404, message = "Not Found", response = Error.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response patchAgentConfiguration(@ApiParam(value = "" ,required=true) @Valid List<AgentConfigPatch> agentConfigPatch) {

return delegate.patchAgentConfiguration(agentConfigPatch );
}

@Valid
@PATCH
@Path("/jwt-key-validator")
Expand Down Expand Up @@ -834,6 +884,28 @@ public Response deleteImpersonationConfiguration() {
return delegate.deleteImpersonationConfiguration();
}

@Valid
@DELETE
@Path("/agent")

@Produces({ "application/json" })
@ApiOperation(value = "Revert the tenant agent configuration.", notes = "Revert the tenant agent configuration. <b>Scope (Permission) required:</b> <br> * internal_config_update ", response = Void.class, authorizations = {
@Authorization(value = "BasicAuth"),
@Authorization(value = "OAuth2", scopes = {

})
}, tags={ "Agent Configurations", })
@ApiResponses(value = {
@ApiResponse(code = 204, message = "Successful deletion", response = Void.class),
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
})
public Response deleteAgentConfiguration() {

return delegate.deleteAgentConfiguration();
}

@Valid
@PUT
@Path("/fraud-detection")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.util.List;

import org.wso2.carbon.identity.api.server.configs.v1.model.AgentConfigPatch;
import org.wso2.carbon.identity.api.server.configs.v1.model.CompatibilitySettings;
import org.wso2.carbon.identity.api.server.configs.v1.model.CORSPatch;
import org.wso2.carbon.identity.api.server.configs.v1.model.ImpersonationPatch;
Expand Down Expand Up @@ -61,6 +62,8 @@ public interface ConfigsApiService {

public Response getImpersonationConfiguration();

public Response getAgentConfiguration();

public Response getInboundScimConfigs();

public Response getIssuerUsageScopeConfig();
Expand Down Expand Up @@ -90,6 +93,8 @@ public interface ConfigsApiService {

public Response patchImpersonationConfiguration(List<ImpersonationPatch> impersonationPatch);

public Response patchAgentConfiguration(List<AgentConfigPatch> agentConfigPatch);

public Response patchPrivatKeyJWTValidationConfiguration(List<JWTKeyValidatorPatch> jwTKeyValidatorPatch);

public Response patchDCRConfiguration(List<DCRPatch> patch);
Expand All @@ -102,6 +107,8 @@ public interface ConfigsApiService {

public Response deleteImpersonationConfiguration();

public Response deleteAgentConfiguration();

public Response updateFraudDetectionConfigs(FraudDetectionConfig fraudDetectionConfig);

public Response updateInboundScimConfigs(ScimConfig scimConfig);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
/*
* Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.api.server.configs.v1.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.*;


import io.swagger.annotations.*;
import java.util.Objects;
import javax.validation.Valid;
import javax.xml.bind.annotation.*;

public class AgentConfigPatch {


@XmlType(name="OperationEnum")
@XmlEnum(String.class)
public enum OperationEnum {

@XmlEnumValue("ADD") ADD(String.valueOf("ADD")), @XmlEnumValue("REPLACE") REPLACE(String.valueOf("REPLACE"));


private String value;

OperationEnum(String v) {
value = v;
}

public String value() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

public static OperationEnum fromValue(String value) {
for (OperationEnum b : OperationEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}

private OperationEnum operation;
private String path;
private Boolean value;

/**
* The operation to be performed.
**/
public AgentConfigPatch operation(OperationEnum operation) {

this.operation = operation;
return this;
}

@ApiModelProperty(example = "REPLACE", required = true, value = "The operation to be performed.")
@JsonProperty("operation")
@Valid
@NotNull(message = "Property operation cannot be null.")

public OperationEnum getOperation() {
return operation;
}
public void setOperation(OperationEnum operation) {
this.operation = operation;
}

/**
* A JSON-Pointer
**/
public AgentConfigPatch path(String path) {

this.path = path;
return this;
}

@ApiModelProperty(example = "/agentsExternallyManaged", required = true, value = "A JSON-Pointer")
@JsonProperty("path")
@Valid
@NotNull(message = "Property path cannot be null.")

public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}

/**
* The value to be used within the operations.
**/
public AgentConfigPatch value(Boolean value) {

this.value = value;
return this;
}

@ApiModelProperty(example = "true", required = true, value = "The value to be used within the operations.")
@JsonProperty("value")
@Valid
@NotNull(message = "Property value cannot be null.")

public Boolean getValue() {
return value;
}
public void setValue(Boolean value) {
this.value = value;
}



@Override
public boolean equals(java.lang.Object o) {

if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AgentConfigPatch agentConfigPatch = (AgentConfigPatch) o;
return Objects.equals(this.operation, agentConfigPatch.operation) &&
Objects.equals(this.path, agentConfigPatch.path) &&
Objects.equals(this.value, agentConfigPatch.value);
}

@Override
public int hashCode() {
return Objects.hash(operation, path, value);
}

@Override
public String toString() {

StringBuilder sb = new StringBuilder();
sb.append("class AgentConfigPatch {\n");

sb.append(" operation: ").append(toIndentedString(operation)).append("\n");
sb.append(" path: ").append(toIndentedString(path)).append("\n");
sb.append(" value: ").append(toIndentedString(value)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {

if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n");
}
}
Loading
Loading