diff --git a/components/org.wso2.carbon.identity.query.saml/pom.xml b/components/org.wso2.carbon.identity.query.saml/pom.xml
index 9186eb0ef..e82362f8f 100644
--- a/components/org.wso2.carbon.identity.query.saml/pom.xml
+++ b/components/org.wso2.carbon.identity.query.saml/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.identity.inbound.auth.saml2
identity-inbound-auth-saml
../../pom.xml
- 5.11.17-SNAPSHOT
+ 5.11.19-SNAPSHOT
4.0.0
org.wso2.carbon.identity.query.saml
diff --git a/components/org.wso2.carbon.identity.sso.saml.common/pom.xml b/components/org.wso2.carbon.identity.sso.saml.common/pom.xml
index 7ec7fcdc7..e448a16fa 100644
--- a/components/org.wso2.carbon.identity.sso.saml.common/pom.xml
+++ b/components/org.wso2.carbon.identity.sso.saml.common/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.identity.inbound.auth.saml2
identity-inbound-auth-saml
../../pom.xml
- 5.11.17-SNAPSHOT
+ 5.11.19-SNAPSHOT
4.0.0
diff --git a/components/org.wso2.carbon.identity.sso.saml.stub/pom.xml b/components/org.wso2.carbon.identity.sso.saml.stub/pom.xml
index 376f10b62..4364e95bb 100644
--- a/components/org.wso2.carbon.identity.sso.saml.stub/pom.xml
+++ b/components/org.wso2.carbon.identity.sso.saml.stub/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.identity.inbound.auth.saml2
identity-inbound-auth-saml
../../pom.xml
- 5.11.17-SNAPSHOT
+ 5.11.19-SNAPSHOT
4.0.0
diff --git a/components/org.wso2.carbon.identity.sso.saml.ui/pom.xml b/components/org.wso2.carbon.identity.sso.saml.ui/pom.xml
index b1d8a8145..d4e8d554c 100644
--- a/components/org.wso2.carbon.identity.sso.saml.ui/pom.xml
+++ b/components/org.wso2.carbon.identity.sso.saml.ui/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.identity.inbound.auth.saml2
identity-inbound-auth-saml
../../pom.xml
- 5.11.17-SNAPSHOT
+ 5.11.19-SNAPSHOT
4.0.0
diff --git a/components/org.wso2.carbon.identity.sso.saml/pom.xml b/components/org.wso2.carbon.identity.sso.saml/pom.xml
index 2be37fc79..cebb47e71 100644
--- a/components/org.wso2.carbon.identity.sso.saml/pom.xml
+++ b/components/org.wso2.carbon.identity.sso.saml/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.identity.inbound.auth.saml2
identity-inbound-auth-saml
../../pom.xml
- 5.11.17-SNAPSHOT
+ 5.11.19-SNAPSHOT
4.0.0
@@ -293,6 +293,11 @@
slf4j-api
test
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ provided
+
org.apache.felix
org.apache.felix.scr.ds-annotations
diff --git a/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/SAMLInboundSessionContextMgtListener.java b/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/SAMLInboundSessionContextMgtListener.java
index a44c80813..abd742faa 100644
--- a/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/SAMLInboundSessionContextMgtListener.java
+++ b/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/SAMLInboundSessionContextMgtListener.java
@@ -23,11 +23,11 @@
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext;
import org.wso2.carbon.identity.application.authentication.framework.listener.SessionContextMgtListener;
-import org.wso2.carbon.registry.core.utils.UUIDGenerator;
import org.wso2.carbon.identity.core.util.IdentityTenantUtil;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@@ -66,9 +66,9 @@ public Map onPreCreateSession(String sessionId, HttpServletReque
}
if (IdentityTenantUtil.isTenantedSessionsEnabled()) {
// Add suffix to the session id for identify saml sso token id cookies which has a tenanted path.
- sessionId = UUIDGenerator.generateUUID() + SAMLSSOConstants.TENANT_QUALIFIED_TOKEN_ID_COOKIE_SUFFIX;
+ sessionId = UUID.randomUUID() + SAMLSSOConstants.TENANT_QUALIFIED_TOKEN_ID_COOKIE_SUFFIX;
} else {
- sessionId = UUIDGenerator.generateUUID();
+ sessionId = UUID.randomUUID().toString();
}
}
Map map = new HashMap<>();
diff --git a/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/SAMLSSOConstants.java b/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/SAMLSSOConstants.java
index 3de330555..1cfa6c0a8 100644
--- a/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/SAMLSSOConstants.java
+++ b/components/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/SAMLSSOConstants.java
@@ -201,6 +201,15 @@ private StatusCodes() {
}
}
+ /**
+ * Group the constants related to logs.
+ */
+ public static class LogConstants {
+
+ public static final String CREATE_SAML_APPLICATION = "CREATE SAML APPLICATION";
+ public static final String DELETE_SAML_APPLICATION = "DELETE SAML APPLICATION";
+ }
+
public static class SingleLogoutCodes {
public static final String LOGOUT_USER = "urn:oasis:names:tc:SAML:2.0:logout:user";
public static final String LOGOUT_ADMIN = "urn:oasis:names:tc:SAML:2.0:logout:admin";
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 81548aa71..5d7ea32bc 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
@@ -18,6 +18,8 @@
package org.wso2.carbon.identity.sso.saml.admin;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -25,6 +27,8 @@
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.core.util.KeyStoreManager;
+import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser;
+import org.wso2.carbon.identity.application.mgt.ApplicationMgtUtil;
import org.wso2.carbon.identity.base.IdentityException;
import org.wso2.carbon.identity.core.model.SAMLSSOServiceProviderDO;
import org.wso2.carbon.identity.core.util.IdentityTenantUtil;
@@ -32,6 +36,7 @@
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;
@@ -41,10 +46,18 @@
import org.wso2.carbon.identity.sso.saml.util.SAMLSSOUtil;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.session.UserRegistry;
+import org.wso2.carbon.user.core.util.UserCoreUtil;
+import org.wso2.carbon.utils.AuditLog;
import java.security.KeyStore;
import java.security.cert.CertificateException;
+import java.util.HashMap;
+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.central.log.mgt.utils.LoggerUtils.triggerAuditLogEvent;
import static org.wso2.carbon.identity.sso.saml.Error.CONFLICTING_SAML_ISSUER;
import static org.wso2.carbon.identity.sso.saml.Error.INVALID_REQUEST;
@@ -86,8 +99,22 @@ public boolean addRelyingPartyServiceProvider(SAMLSSOServiceProviderDTO serviceP
log.error(message);
return false;
}
- return IdentitySAMLSSOServiceComponentHolder.getInstance().getSAMLSSOServiceProviderManager()
+ boolean isSuccess = IdentitySAMLSSOServiceComponentHolder.getInstance().getSAMLSSOServiceProviderManager()
.addServiceProvider(serviceProviderDO, tenantId);
+ if (isSuccess && ApplicationMgtUtil.isLegacyAuditLogsDisabledInAppMgt()) {
+ Optional initiatorId = getInitiatorId();
+ if (initiatorId.isPresent()) {
+ AuditLog.AuditLogBuilder auditLogBuilder = new AuditLog.AuditLogBuilder(
+ initiatorId.get(), USER,
+ issuer, TARGET_APPLICATION,
+ SAMLSSOConstants.LogConstants.CREATE_SAML_APPLICATION)
+ .data(buildSPData(serviceProviderDO));
+ triggerAuditLogEvent(auditLogBuilder, true);
+ } else {
+ log.error("Error getting the logged in userId");
+ }
+ }
+ return isSuccess;
} catch (IdentityException e) {
String message = "Error obtaining a registry for adding a new service provider";
throw new IdentityException(message, e);
@@ -140,7 +167,21 @@ public SAMLSSOServiceProviderDTO addSAMLServiceProvider(SAMLSSOServiceProviderDT
String message = "A Service Provider with the name: " + issuer + " is already loaded from the file system.";
throw buildClientException(CONFLICTING_SAML_ISSUER, message);
}
- return persistSAMLServiceProvider(serviceProviderDO);
+ SAMLSSOServiceProviderDTO samlssoServiceProviderDTO = persistSAMLServiceProvider(serviceProviderDO);
+ if (ApplicationMgtUtil.isLegacyAuditLogsDisabledInAppMgt()) {
+ Optional initiatorId = getInitiatorId();
+ if (initiatorId.isPresent()) {
+ AuditLog.AuditLogBuilder auditLogBuilder = new AuditLog.AuditLogBuilder(
+ initiatorId.get(), USER,
+ issuer, TARGET_APPLICATION,
+ SAMLSSOConstants.LogConstants.CREATE_SAML_APPLICATION)
+ .data(buildSPData(serviceProviderDO));
+ triggerAuditLogEvent(auditLogBuilder, true);
+ } else {
+ log.error("Error getting the logged in userId");
+ }
+ }
+ return samlssoServiceProviderDTO;
} catch (IdentitySAML2ClientException e){
throw e;
} catch (IdentityException e) {
@@ -149,6 +190,47 @@ public SAMLSSOServiceProviderDTO addSAMLServiceProvider(SAMLSSOServiceProviderDT
}
}
+ private static Map buildSPData(SAMLSSOServiceProviderDO app) {
+
+ if (app == null) {
+ return new HashMap<>();
+ }
+
+ Gson gson = new Gson();
+ String json = gson.toJson(app);
+ return gson.fromJson(json, new TypeToken
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${com.fasterxml.jackson.version}
+
org.wso2.carbon.identity.inbound.auth.saml2
org.wso2.carbon.identity.sso.saml.common
@@ -450,7 +455,7 @@
- 4.9.0
+ 4.9.10
4.9.0
5.25.260
[5.25.234, 7.0.0)
@@ -470,6 +475,7 @@
1.2.0.wso2v1
1.6.1.wso2v12
2.9.4.wso2v1
+ 2.13.2
3.2.0
2.3.1