Skip to content

Commit ad4d994

Browse files
authored
Merge pull request #981 from wso2/sync-pr-977-to-next
[Sync][master -> next][#977]: Add revert API for impersonation configurations.
2 parents 6c4797a + 6f87a23 commit ad4d994

File tree

7 files changed

+74
-3
lines changed

7 files changed

+74
-3
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ public enum ErrorMessage {
205205
"Server encountered an error while deleting the SAML inbound auth configs."),
206206
ERROR_CODE_ERROR_PASSIVE_STS_INBOUND_AUTH_CONFIG_DELETE("65021",
207207
"Unable to delete Passive STS inbound auth configs.",
208-
"Server encountered an error while deleting the Passive STS inbound auth configs.");
208+
"Server encountered an error while deleting the Passive STS inbound auth configs."),
209+
ERROR_CODE_IMP_CONFIG_DELETE("65022",
210+
"Unable to delete Impersonation configuration.",
211+
"Server encountered an error while deleting the Impersonation configuration of %s.");
209212

210213
private final String code;
211214
private final String message;

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.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,28 @@ public Response restoreServerRemoteLoggingConfigurations() {
639639
return delegate.restoreServerRemoteLoggingConfigurations();
640640
}
641641

642+
@Valid
643+
@DELETE
644+
@Path("/impersonation")
645+
646+
@Produces({ "application/json" })
647+
@ApiOperation(value = "Revert the tenant impersonation configuration.", notes = "Revert the tenant impersonation configuration. <b>Scope (Permission) required:</b> <br> * internal_config_update ", response = Void.class, authorizations = {
648+
@Authorization(value = "BasicAuth"),
649+
@Authorization(value = "OAuth2", scopes = {
650+
651+
})
652+
}, tags={ "Impersonation Configurations", })
653+
@ApiResponses(value = {
654+
@ApiResponse(code = 204, message = "Successful deletion", response = Void.class),
655+
@ApiResponse(code = 401, message = "Unauthorized", response = Void.class),
656+
@ApiResponse(code = 403, message = "Forbidden", response = Void.class),
657+
@ApiResponse(code = 500, message = "Server Error", response = Error.class)
658+
})
659+
public Response deleteImpersonationConfiguration() {
660+
661+
return delegate.deleteImpersonationConfiguration();
662+
}
663+
642664
@Valid
643665
@PUT
644666
@Path("/provisioning/inbound/scim")

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.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ public interface ConfigsApiService {
9494

9595
public Response restoreServerRemoteLoggingConfigurations();
9696

97+
public Response deleteImpersonationConfiguration();
98+
9799
public Response updateInboundScimConfigs(ScimConfig scimConfig);
98100

99101
public Response updatePassiveSTSInboundAuthConfig(InboundAuthPassiveSTSConfig inboundAuthPassiveSTSConfig);

components/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.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,21 @@ public void patchImpersonationConfiguration(List<ImpersonationPatch> impersonati
440440
}
441441
}
442442

443+
/**
444+
* Deletes the impersonation configuration for the current tenant domain.
445+
*
446+
* @throws ImpersonationConfigMgtException If there is an error deleting the impersonation configuration.
447+
*/
448+
public void deleteImpersonationConfiguration() {
449+
450+
String tenantDomain = ContextLoader.getTenantDomainFromContext();
451+
try {
452+
impersonationConfigMgtService.deleteImpersonationConfig(tenantDomain);
453+
} catch (ImpersonationConfigMgtException e) {
454+
throw handleImpersonationConfigException(e, Constants.ErrorMessage.ERROR_CODE_IMP_CONFIG_DELETE,
455+
tenantDomain);
456+
}
457+
}
443458

444459
/**
445460
* Get the CORS config for a tenant.

components/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.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,13 @@ public Response patchImpersonationConfiguration(List<ImpersonationPatch> imperso
192192
return Response.ok().build();
193193
}
194194

195+
@Override
196+
public Response deleteImpersonationConfiguration() {
197+
198+
configManagementService.deleteImpersonationConfiguration();
199+
return Response.noContent().build();
200+
}
201+
195202
@Override
196203
public Response updateInboundScimConfigs(ScimConfig scimConfig) {
197204

components/org.wso2.carbon.identity.api.server.configs/org.wso2.carbon.identity.api.server.configs.v1/src/main/resources/configs.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,28 @@ paths:
546546
application/json:
547547
schema:
548548
$ref: '#/components/schemas/Error'
549+
delete:
550+
tags:
551+
- Impersonation Configurations
552+
summary: Revert the tenant impersonation configuration.
553+
operationId: deleteImpersonationConfiguration
554+
description: |
555+
Revert the tenant impersonation configuration.
556+
<b>Scope (Permission) required:</b> <br>
557+
* internal_config_update
558+
responses:
559+
'204':
560+
description: Successful deletion
561+
'401':
562+
description: Unauthorized
563+
'403':
564+
description: Forbidden
565+
'500':
566+
description: Server Error
567+
content:
568+
application/json:
569+
schema:
570+
$ref: '#/components/schemas/Error'
549571
/configs/home-realm-identifiers:
550572
get:
551573
tags:

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,12 +958,12 @@
958958
<maven.buildnumber.plugin.version>1.4</maven.buildnumber.plugin.version>
959959
<org.apache.felix.annotations.version>1.2.4</org.apache.felix.annotations.version>
960960
<identity.governance.version>1.11.103</identity.governance.version>
961-
<carbon.identity.framework.version>7.8.405</carbon.identity.framework.version>
961+
<carbon.identity.framework.version>7.8.466</carbon.identity.framework.version>
962962
<maven.findbugsplugin.version>3.0.5</maven.findbugsplugin.version>
963963
<findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
964964
<maven.checkstyleplugin.excludes>**/gen/**/*</maven.checkstyleplugin.excludes>
965965
<identity.event.handler.version>1.9.48</identity.event.handler.version>
966-
<identity.inbound.oauth2.version>7.0.302</identity.inbound.oauth2.version>
966+
<identity.inbound.oauth2.version>7.0.350</identity.inbound.oauth2.version>
967967
<identity.inbound.saml2.version>5.11.51</identity.inbound.saml2.version>
968968
<identity.x509Certificate.validation.version>1.1.19</identity.x509Certificate.validation.version>
969969
<commons.beanutils.version>1.9.4</commons.beanutils.version>

0 commit comments

Comments
 (0)