From 31b68454f189d1081f972b293fdc0dd301dccf34 Mon Sep 17 00:00:00 2001 From: vivekvinushanth Date: Mon, 18 Mar 2024 17:46:12 +0530 Subject: [PATCH 1/3] fix log constants --- .../sso/saml/admin/SAMLSSOConfigAdmin.java | 34 +++++++++++-------- pom.xml | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/admin/SAMLSSOConfigAdmin.java b/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/admin/SAMLSSOConfigAdmin.java index 57501058..28a78b74 100644 --- a/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/admin/SAMLSSOConfigAdmin.java +++ b/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/admin/SAMLSSOConfigAdmin.java @@ -27,6 +27,8 @@ import org.wso2.carbon.core.util.KeyStoreManager; import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; import org.wso2.carbon.identity.base.IdentityException; +import org.wso2.carbon.identity.central.log.mgt.utils.LogConstants; +import org.wso2.carbon.identity.central.log.mgt.utils.LoggerUtils; import org.wso2.carbon.identity.core.model.SAMLSSOServiceProviderDO; import org.wso2.carbon.identity.core.util.IdentityTenantUtil; import org.wso2.carbon.identity.core.util.IdentityUtil; @@ -110,9 +112,9 @@ public boolean addRelyingPartyServiceProvider(SAMLSSOServiceProviderDTO serviceP Optional initiatorId = getInitiatorId(); if (initiatorId.isPresent()) { AuditLog.AuditLogBuilder auditLogBuilder = new AuditLog.AuditLogBuilder( - initiatorId.get(), USER, - issuer, TARGET_APPLICATION, - SAMLSSOConstants.LogConstants.CREATE_SAML_APPLICATION) + initiatorId.get(), LoggerUtils.Initiator.User.name(), + issuer, LoggerUtils.Target.Application.name(), + LogConstants.ApplicationManagement.CREATE_SAML_APPLICATION_ACTION) .data(SAMLSSOUtil.buildSPData(serviceProviderDO)); triggerAuditLogEvent(auditLogBuilder, true); } else { @@ -179,9 +181,9 @@ public SAMLSSOServiceProviderDTO addSAMLServiceProvider(SAMLSSOServiceProviderDT Optional initiatorId = getInitiatorId(); if (initiatorId.isPresent()) { AuditLog.AuditLogBuilder auditLogBuilder = new AuditLog.AuditLogBuilder( - initiatorId.get(), USER, - issuer, TARGET_APPLICATION, - SAMLSSOConstants.LogConstants.CREATE_SAML_APPLICATION) + initiatorId.get(), LoggerUtils.Initiator.User.name(), + issuer, LoggerUtils.Target.Application.name(), + LogConstants.ApplicationManagement.CREATE_SAML_APPLICATION_ACTION) .data(SAMLSSOUtil.buildSPData(serviceProviderDO)); triggerAuditLogEvent(auditLogBuilder, true); } else { @@ -257,8 +259,9 @@ public SAMLSSOServiceProviderDTO updateSAMLServiceProvider(SAMLSSOServiceProvide Optional initiatorId = getInitiatorId(); if (initiatorId.isPresent()) { AuditLog.AuditLogBuilder auditLogBuilder = new AuditLog.AuditLogBuilder( - initiatorId.get(), USER, serviceProviderDO.getIssuer(), TARGET_APPLICATION, - SAMLSSOConstants.LogConstants.UPDATE_SAML_APPLICATION) + initiatorId.get(), LoggerUtils.Initiator.User.name(), serviceProviderDO.getIssuer(), + LoggerUtils.Target.Application.name(), + LogConstants.ApplicationManagement.UPDATE_SAML_APPLICATION_ACTION) .data(SAMLSSOUtil.buildSPData(serviceProviderDO)); triggerAuditLogEvent(auditLogBuilder, true); } else { @@ -385,9 +388,9 @@ public SAMLSSOServiceProviderDTO uploadRelyingPartyServiceProvider(String metada Optional initiatorId = getInitiatorId(); if (initiatorId.isPresent()) { AuditLog.AuditLogBuilder auditLogBuilder = new AuditLog.AuditLogBuilder( - initiatorId.get(), USER, - samlssoServiceProviderDO.getIssuer(), TARGET_APPLICATION, - SAMLSSOConstants.LogConstants.CREATE_SAML_APPLICATION) + initiatorId.get(), LoggerUtils.Initiator.User.name(), + samlssoServiceProviderDO.getIssuer(), LoggerUtils.Target.Application.name(), + LogConstants.ApplicationManagement.CREATE_SAML_APPLICATION_ACTION) .data(SAMLSSOUtil.buildSPData(samlssoServiceProviderDO)); triggerAuditLogEvent(auditLogBuilder, true); } else { @@ -436,8 +439,9 @@ public SAMLSSOServiceProviderDTO updateRelyingPartyServiceProviderWithMetadata(S Optional initiatorId = getInitiatorId(); if (initiatorId.isPresent()) { AuditLog.AuditLogBuilder auditLogBuilder = new AuditLog.AuditLogBuilder( - initiatorId.get(), USER, samlssoServiceProviderDO.getIssuer(), TARGET_APPLICATION, - SAMLSSOConstants.LogConstants.UPDATE_SAML_APPLICATION) + initiatorId.get(), LoggerUtils.Initiator.User.name(), samlssoServiceProviderDO.getIssuer(), + LoggerUtils.Target.Application.name(), + LogConstants.ApplicationManagement.UPDATE_SAML_APPLICATION_ACTION) .data(SAMLSSOUtil.buildSPData(samlssoServiceProviderDO)); triggerAuditLogEvent(auditLogBuilder, true); } else { @@ -735,8 +739,8 @@ public boolean removeServiceProvider(String issuer) throws IdentityException { Optional initiatorId = getInitiatorId(); if (initiatorId.isPresent()) { AuditLog.AuditLogBuilder auditLogBuilder = new AuditLog.AuditLogBuilder(initiatorId.get(), - USER, issuer, TARGET_APPLICATION, - SAMLSSOConstants.LogConstants.DELETE_SAML_APPLICATION); + LoggerUtils.Initiator.User.name(), issuer, LoggerUtils.Target.Application.name(), + LogConstants.ApplicationManagement.DELETE_SAML_APPLICATION_ACTION); triggerAuditLogEvent(auditLogBuilder, true); } else { log.error("Error getting the logged in userId"); diff --git a/pom.xml b/pom.xml index 35447564..29e9a724 100644 --- a/pom.xml +++ b/pom.xml @@ -462,7 +462,7 @@ 4.9.23 4.9.0 - 7.0.40 + 7.0.105 [5.25.260, 8.0.0) 1.0.0 From 42325307ac087ea6b324220bc167cf66d03fe4ca Mon Sep 17 00:00:00 2001 From: vivekvinushanth Date: Mon, 18 Mar 2024 18:01:08 +0530 Subject: [PATCH 2/3] add dependency --- components/org.wso2.carbon.identity.sso.saml/pom.xml | 5 +++++ pom.xml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/components/org.wso2.carbon.identity.sso.saml/pom.xml b/components/org.wso2.carbon.identity.sso.saml/pom.xml index 48c9a650..f7bc3546 100755 --- a/components/org.wso2.carbon.identity.sso.saml/pom.xml +++ b/components/org.wso2.carbon.identity.sso.saml/pom.xml @@ -69,6 +69,10 @@ + + org.wso2.carbon.identity.framework + org.wso2.carbon.identity.central.log.mgt + org.wso2.carbon.identity.framework org.wso2.carbon.identity.event @@ -433,6 +437,7 @@ org.wso2.carbon.security; version="${carbon.identity.framework.imp.pkg.version.range}", org.wso2.carbon.security.keystore; version="${carbon.identity.framework.imp.pkg.version.range}", org.wso2.carbon.security.keystore.service; version="${carbon.identity.framework.imp.pkg.version.range}", + org.wso2.carbon.identity.central.log.mgt.*; version="${carbon.identity.framework.imp.pkg.version.range}", org.wso2.carbon.user.core, org.wso2.carbon.user.core.claim, org.wso2.carbon.user.core.service, diff --git a/pom.xml b/pom.xml index 29e9a724..7f8e20d3 100644 --- a/pom.xml +++ b/pom.xml @@ -86,6 +86,11 @@ org.wso2.carbon.identity.application.mgt ${carbon.identity.framework.version} + + org.wso2.carbon.identity.framework + org.wso2.carbon.identity.central.log.mgt + ${carbon.identity.framework.version} + org.wso2.carbon.identity.framework org.wso2.carbon.identity.event From b06b3e8461cfc8d09388376d1682123a138da9e5 Mon Sep 17 00:00:00 2001 From: vivekvinushanth Date: Mon, 18 Mar 2024 18:19:33 +0530 Subject: [PATCH 3/3] remove dependency --- components/org.wso2.carbon.identity.sso.saml/pom.xml | 5 ----- .../carbon/identity/sso/saml/admin/SAMLSSOConfigAdmin.java | 3 --- pom.xml | 5 ----- 3 files changed, 13 deletions(-) diff --git a/components/org.wso2.carbon.identity.sso.saml/pom.xml b/components/org.wso2.carbon.identity.sso.saml/pom.xml index f7bc3546..48c9a650 100755 --- a/components/org.wso2.carbon.identity.sso.saml/pom.xml +++ b/components/org.wso2.carbon.identity.sso.saml/pom.xml @@ -69,10 +69,6 @@ - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.central.log.mgt - org.wso2.carbon.identity.framework org.wso2.carbon.identity.event @@ -437,7 +433,6 @@ org.wso2.carbon.security; version="${carbon.identity.framework.imp.pkg.version.range}", org.wso2.carbon.security.keystore; version="${carbon.identity.framework.imp.pkg.version.range}", org.wso2.carbon.security.keystore.service; version="${carbon.identity.framework.imp.pkg.version.range}", - org.wso2.carbon.identity.central.log.mgt.*; version="${carbon.identity.framework.imp.pkg.version.range}", org.wso2.carbon.user.core, org.wso2.carbon.user.core.claim, org.wso2.carbon.user.core.service, diff --git a/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/admin/SAMLSSOConfigAdmin.java b/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/admin/SAMLSSOConfigAdmin.java index 28a78b74..59d8f595 100644 --- a/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/admin/SAMLSSOConfigAdmin.java +++ b/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/admin/SAMLSSOConfigAdmin.java @@ -35,7 +35,6 @@ import org.wso2.carbon.identity.sp.metadata.saml2.exception.InvalidMetadataException; import org.wso2.carbon.identity.sp.metadata.saml2.util.Parser; import org.wso2.carbon.identity.sso.saml.Error; -import org.wso2.carbon.identity.sso.saml.SAMLSSOConstants; import org.wso2.carbon.identity.sso.saml.SSOServiceProviderConfigManager; import org.wso2.carbon.identity.sso.saml.dto.SAMLSSOServiceProviderDTO; import org.wso2.carbon.identity.sso.saml.dto.SAMLSSOServiceProviderInfoDTO; @@ -54,8 +53,6 @@ import java.util.Map; import java.util.Optional; -import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.LogConstants.USER; -import static org.wso2.carbon.identity.application.mgt.ApplicationConstants.LogConstants.TARGET_APPLICATION; import static org.wso2.carbon.identity.application.mgt.ApplicationMgtUtil.isEnableV2AuditLogs; import static org.wso2.carbon.identity.central.log.mgt.utils.LoggerUtils.triggerAuditLogEvent; import static org.wso2.carbon.identity.sso.saml.Error.CONFLICTING_SAML_ISSUER; diff --git a/pom.xml b/pom.xml index 7f8e20d3..29e9a724 100644 --- a/pom.xml +++ b/pom.xml @@ -86,11 +86,6 @@ org.wso2.carbon.identity.application.mgt ${carbon.identity.framework.version} - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.central.log.mgt - ${carbon.identity.framework.version} - org.wso2.carbon.identity.framework org.wso2.carbon.identity.event