diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/dbscripts/h2.sql b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/dbscripts/h2.sql
index 4dc871f5af93..6a254b1b4c27 100644
--- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/dbscripts/h2.sql
+++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/dbscripts/h2.sql
@@ -605,6 +605,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE);
diff --git a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/src/test/resources/dbscripts/h2.sql b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/src/test/resources/dbscripts/h2.sql
index 66edbc6db4c3..e45d08bcf056 100644
--- a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/src/test/resources/dbscripts/h2.sql
+++ b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/src/test/resources/dbscripts/h2.sql
@@ -590,6 +590,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE);
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java
index 40ad2fb904b5..557a1adcafa1 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java
+++ b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java
@@ -22,6 +22,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
+import org.wso2.carbon.identity.base.IdentityConstants;
import java.io.Serializable;
import java.util.ArrayList;
@@ -63,6 +64,8 @@ public class FederatedAuthenticatorConfig implements Serializable {
@XmlElement(name = "Tags")
protected String[] tags;
+ protected IdentityConstants.DefinedByType definedByType;
+
public static FederatedAuthenticatorConfig build(OMElement federatedAuthenticatorConfigOM) {
if (federatedAuthenticatorConfigOM == null) {
@@ -230,4 +233,24 @@ public void setTags(String[] tagList) {
tags = tagList;
}
+
+ /**
+ * Get the tag list of the Local authenticator.
+ *
+ * @return String[]
+ */
+ public IdentityConstants.DefinedByType getDefinedByType() {
+
+ return definedByType;
+ }
+
+ /**
+ * Set the tag list for Local authenticator config.
+ *
+ * @param type authenticator.
+ */
+ public void setDefinedByType(IdentityConstants.DefinedByType type) {
+
+ definedByType = type;
+ }
}
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java
index cfe369a544e3..367727157ea1 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java
+++ b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java
@@ -63,6 +63,8 @@ public class LocalAuthenticatorConfig implements Serializable {
@XmlElement(name = "Tags")
protected String[] tags;
+ protected IdentityConstants.DefinedByType definedByType;
+
/*
*
*
@@ -224,4 +226,24 @@ public void setTags(String[] tagList) {
tags = tagList;
}
+
+ /**
+ * Get the tag list of the Local authenticator.
+ *
+ * @return String[]
+ */
+ public IdentityConstants.DefinedByType getDefinedByType() {
+
+ return definedByType;
+ }
+
+ /**
+ * Set the tag list for Local authenticator config.
+ *
+ * @param type authenticator.
+ */
+ public void setDefinedByType(IdentityConstants.DefinedByType type) {
+
+ definedByType = type;
+ }
}
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationMgtDBQueries.java b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationMgtDBQueries.java
index 70ffca50df7d..92ef160eaea1 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationMgtDBQueries.java
+++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationMgtDBQueries.java
@@ -289,7 +289,8 @@ public class ApplicationMgtDBQueries {
"B.DISPLAY_NAME FROM IDP A JOIN IDP_AUTHENTICATOR B ON A.ID = B.IDP_ID WHERE B.ID =? AND ((A.TENANT_ID =?" +
" AND B.TENANT_ID =?) OR (A.TENANT_ID=? AND A.NAME LIKE 'SHARED_%' AND B.TENANT_ID=?))";
public static final String STORE_LOCAL_AUTHENTICATOR = "INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME," +
- "IS_ENABLED, DISPLAY_NAME) VALUES (?, (SELECT ID FROM IDP WHERE IDP.NAME=? AND IDP.TENANT_ID =?), ?, ?, ?)";
+ "IS_ENABLED, DISPLAY_NAME, SCOPE) VALUES " +
+ "(?, (SELECT ID FROM IDP WHERE IDP.NAME=? AND IDP.TENANT_ID =?), ?, ?, ?, ?)";
public static final String GET_SP_METADATA_BY_SP_ID = "SELECT ID, NAME, VALUE, DISPLAY_NAME FROM SP_METADATA " +
"WHERE SP_ID = ?";
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java
index 745068863338..4e6c0a9a1f79 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java
+++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java
@@ -77,6 +77,7 @@
import org.wso2.carbon.identity.application.mgt.dao.PaginatableFilterableApplicationDAO;
import org.wso2.carbon.identity.application.mgt.internal.ApplicationManagementServiceComponent;
import org.wso2.carbon.identity.application.mgt.internal.ApplicationManagementServiceComponentHolder;
+import org.wso2.carbon.identity.base.IdentityConstants;
import org.wso2.carbon.identity.base.IdentityException;
import org.wso2.carbon.identity.base.IdentityRuntimeException;
import org.wso2.carbon.identity.core.CertificateRetrievingException;
@@ -1566,6 +1567,9 @@ private void updateLocalAndOutboundAuthenticationConfiguration(int applicationId
ApplicationConstants.LOCAL_IDP_NAME,
lclAuthenticator.getName(),
lclAuthenticator.getDisplayName());
+ } else {
+ addAuthenticatorDefinedByType(connection, tenantID, authenticatorId,
+ lclAuthenticator.getDefinedByType().toString());
}
if (authenticatorId > 0) {
// ID, TENANT_ID, AUTHENTICATOR_ID
@@ -5038,7 +5042,7 @@ private int addAuthenticator(Connection conn, int tenantId, String idpName,
int authenticatorId = -1;
PreparedStatement prepStmt = null;
ResultSet rs = null;
- // TENANT_ID, IDP_ID, NAME,IS_ENABLED, DISPLAY_NAME
+ // TENANT_ID, IDP_ID, NAME,IS_ENABLED, DISPLAY_NAME, DEFINED_BY
String sqlStmt = ApplicationMgtDBQueries.STORE_LOCAL_AUTHENTICATOR;
try {
String dbProductName = conn.getMetaData().getDatabaseProductName();
@@ -5050,6 +5054,7 @@ private int addAuthenticator(Connection conn, int tenantId, String idpName,
prepStmt.setString(4, authenticatorName);
prepStmt.setString(5, "1");
prepStmt.setString(6, authenticatorDispalyName);
+ prepStmt.setString(7, IdentityConstants.DefinedByType.SYSTEM.toString());
prepStmt.execute();
rs = prepStmt.getGeneratedKeys();
if (rs.next()) {
@@ -5061,6 +5066,25 @@ private int addAuthenticator(Connection conn, int tenantId, String idpName,
return authenticatorId;
}
+ private void addAuthenticatorDefinedByType(Connection conn, int tenantId, int authenticatorId,
+ String authenticatorDefinedByType) throws SQLException {
+
+ PreparedStatement prepStmt = null;
+ ResultSet rs = null;
+ String sqlStmt = ApplicationMgtDBQueries.UPDATE_AUTHENTICATOR_DEFINED_BY_TYPE;
+ try {
+ String dbProductName = conn.getMetaData().getDatabaseProductName();
+ prepStmt = conn.prepareStatement(sqlStmt, new String[] {
+ DBUtils.getConvertedAutoGeneratedColumnName(dbProductName, "ID")});
+ prepStmt.setString(1, authenticatorDefinedByType);
+ prepStmt.setInt(2, authenticatorId);
+ prepStmt.setInt(3, tenantId);
+ prepStmt.execute();
+ } finally {
+ IdentityApplicationManagementUtil.closeStatement(prepStmt);
+ }
+ }
+
/**
* Read application role permissions for a given application name
*
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationMgtDBQueries.java b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationMgtDBQueries.java
index d5818025a738..30fe29d95529 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationMgtDBQueries.java
+++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationMgtDBQueries.java
@@ -293,7 +293,10 @@ public class ApplicationMgtDBQueries {
"B.DISPLAY_NAME FROM IDP A JOIN IDP_AUTHENTICATOR B ON A.ID = B.IDP_ID WHERE B.ID =? AND ((A.TENANT_ID =?" +
" AND B.TENANT_ID =?) OR (A.TENANT_ID=? AND A.NAME LIKE 'SHARED_%' AND B.TENANT_ID=?))";
public static final String STORE_LOCAL_AUTHENTICATOR = "INSERT INTO IDP_AUTHENTICATOR (TENANT_ID, IDP_ID, NAME," +
- "IS_ENABLED, DISPLAY_NAME) VALUES (?, (SELECT ID FROM IDP WHERE IDP.NAME=? AND IDP.TENANT_ID =?), ?, ?, ?)";
+ "IS_ENABLED, DISPLAY_NAME, DEFINED_BY) VALUES " +
+ "(?, (SELECT ID FROM IDP WHERE IDP.NAME=? AND IDP.TENANT_ID =?), ?, ?, ?, ?)";
+ public static final String UPDATE_AUTHENTICATOR_DEFINED_BY_TYPE = "UPDATE IDP_AUTHENTICATOR SET " +
+ "DEFINED_BY= ? WHERE ID = ? AND TENANT_ID = ?";
public static final String GET_SP_METADATA_BY_SP_ID = "SELECT ID, NAME, VALUE, DISPLAY_NAME FROM SP_METADATA " +
"WHERE SP_ID = ?";
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/test/resources/dbscripts/identity.sql b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/test/resources/dbscripts/identity.sql
index ff1e7a44b2d4..4ec3188658cd 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/test/resources/dbscripts/identity.sql
+++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/test/resources/dbscripts/identity.sql
@@ -602,6 +602,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE);
diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/ApplicationAuthenticator.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/ApplicationAuthenticator.java
index 6c974a31d83b..c9756c44a120 100644
--- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/ApplicationAuthenticator.java
+++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/ApplicationAuthenticator.java
@@ -24,6 +24,7 @@
import org.wso2.carbon.identity.application.authentication.framework.exception.LogoutFailedException;
import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatorData;
import org.wso2.carbon.identity.application.common.model.Property;
+import org.wso2.carbon.identity.base.IdentityConstants;
import java.io.Serializable;
import java.util.List;
@@ -171,4 +172,13 @@ default String getI18nKey() {
return StringUtils.EMPTY;
}
+ /**
+ * Get the authenticator type. Default value will be SYSTEM.
+ *
+ * @return Authenticator Type.
+ */
+ default IdentityConstants.DefinedByType getDefinedByType() {
+
+ return IdentityConstants.DefinedByType.SYSTEM;
+ }
}
diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/internal/FrameworkServiceComponent.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/internal/FrameworkServiceComponent.java
index c781132f5f08..e07d52a59813 100644
--- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/internal/FrameworkServiceComponent.java
+++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/internal/FrameworkServiceComponent.java
@@ -99,6 +99,7 @@
import org.wso2.carbon.identity.application.common.model.Property;
import org.wso2.carbon.identity.application.common.model.RequestPathAuthenticatorConfig;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
+import org.wso2.carbon.identity.base.IdentityConstants;
import org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataManagementService;
import org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManager;
import org.wso2.carbon.identity.core.handler.HandlerComparator;
@@ -506,6 +507,7 @@ protected void setAuthenticator(ApplicationAuthenticator authenticator) {
localAuthenticatorConfig.setProperties(configProperties);
localAuthenticatorConfig.setDisplayName(authenticator.getFriendlyName());
localAuthenticatorConfig.setTags(getTags(authenticator));
+ localAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
AuthenticatorConfig fileBasedConfig = getAuthenticatorConfig(authenticator.getName());
localAuthenticatorConfig.setEnabled(fileBasedConfig.isEnabled());
ApplicationAuthenticatorService.getInstance().addLocalAuthenticator(localAuthenticatorConfig);
@@ -515,6 +517,7 @@ protected void setAuthenticator(ApplicationAuthenticator authenticator) {
federatedAuthenticatorConfig.setProperties(configProperties);
federatedAuthenticatorConfig.setDisplayName(authenticator.getFriendlyName());
federatedAuthenticatorConfig.setTags(getTags(authenticator));
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
ApplicationAuthenticatorService.getInstance().addFederatedAuthenticator(federatedAuthenticatorConfig);
} else if (authenticator instanceof RequestPathApplicationAuthenticator) {
RequestPathAuthenticatorConfig reqPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
@@ -524,6 +527,7 @@ protected void setAuthenticator(ApplicationAuthenticator authenticator) {
reqPathAuthenticatorConfig.setTags(getTags(authenticator));
AuthenticatorConfig fileBasedConfig = getAuthenticatorConfig(authenticator.getName());
reqPathAuthenticatorConfig.setEnabled(fileBasedConfig.isEnabled());
+ reqPathAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
ApplicationAuthenticatorService.getInstance().addRequestPathAuthenticator(reqPathAuthenticatorConfig);
}
diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/test/resources/dbScripts/h2.sql b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/test/resources/dbScripts/h2.sql
index f985ed495cff..707df1d55124 100644
--- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/test/resources/dbScripts/h2.sql
+++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/test/resources/dbScripts/h2.sql
@@ -571,6 +571,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE);
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/dbscripts/h2.sql b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/dbscripts/h2.sql
index aa0c8893b4f6..69086bdbb2d5 100644
--- a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/dbscripts/h2.sql
+++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/dbscripts/h2.sql
@@ -593,6 +593,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE);
diff --git a/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/IdentityConstants.java b/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/IdentityConstants.java
index a5b96babf759..c2a3cbdbe557 100644
--- a/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/IdentityConstants.java
+++ b/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/IdentityConstants.java
@@ -619,4 +619,13 @@ public static class APIResponse {
public static final String SET_ACCOUNT_LOCK_AUTH_FAILURE_REASON = "APIResponse.SetAccountLockAuthFailureReason";
}
+
+ /**
+ * The Authentication Type - SYSTEM: system define authenticator, CUSTOM: user defined authentication extension.
+ */
+ public enum DefinedByType {
+
+ SYSTEM,
+ USER
+ }
}
diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java
index 3c382c249765..b43b2f760af3 100644
--- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java
+++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java
@@ -1148,6 +1148,8 @@ private FederatedAuthenticatorConfig[] getFederatedAuthenticatorConfigs(
}
authnConfig.setDisplayName(rs.getString("DISPLAY_NAME"));
+ authnConfig.setDefinedByType(IdentityConstants.DefinedByType.valueOf(
+ rs.getString("DEFINED_BY")));
if (defaultAuthName != null && authnConfig.getName().equals(defaultAuthName)) {
federatedIdp.getDefaultAuthenticatorConfig().setDisplayName(authnConfig.getDisplayName());
@@ -1424,6 +1426,7 @@ public void addFederatedAuthenticatorConfig(FederatedAuthenticatorConfig authnCo
}
prepStmt1.setString(4, authnConfig.getName());
prepStmt1.setString(5, authnConfig.getDisplayName());
+ prepStmt1.setString(6, authnConfig.getDefinedByType().toString());
prepStmt1.execute();
int authnId = getAuthenticatorIdentifier(dbConnection, idpId, authnConfig.getName());
diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/IdPManagementConstants.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/IdPManagementConstants.java
index 0cfbadd94eac..b815943350c0 100644
--- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/IdPManagementConstants.java
+++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/util/IdPManagementConstants.java
@@ -235,7 +235,7 @@ public static class SQLQueries {
public static final String GET_IDP_ID_BY_NAME_SQL = "SELECT ID "
+ "FROM IDP WHERE TENANT_ID=? AND NAME=?";
- public static final String GET_ALL_IDP_AUTH_SQL = "SELECT ID, NAME, IS_ENABLED, DISPLAY_NAME FROM " +
+ public static final String GET_ALL_IDP_AUTH_SQL = "SELECT ID, NAME, IS_ENABLED, DISPLAY_NAME, DEFINED_BY FROM " +
"IDP_AUTHENTICATOR WHERE IDP_ID = ?";
public static final String GET_IDP_AUTH_SQL = "SELECT ID FROM IDP_AUTHENTICATOR WHERE IDP_ID = ? AND NAME = ?";
@@ -357,7 +357,7 @@ public static class SQLQueries {
public static final String TRUSTED_TOKEN_ISSUER_FILTER_SQL = "IDP_METADATA.\"VALUE\" = 'true' AND ";
public static final String ADD_IDP_AUTH_SQL = "INSERT INTO IDP_AUTHENTICATOR " +
- "(IDP_ID, TENANT_ID, IS_ENABLED, NAME, DISPLAY_NAME) VALUES (?,?,?,?,?)";
+ "(IDP_ID, TENANT_ID, IS_ENABLED, NAME, DISPLAY_NAME, DEFINED_BY) VALUES (?,?,?,?,?,?)";
public static final String DELETE_IDP_AUTH_SQL = "DELETE FROM IDP_AUTHENTICATOR WHERE IDP_ID=? AND NAME=?";
diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/IdentityProviderManagementServiceTest.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/IdentityProviderManagementServiceTest.java
index a9c3a7926b21..d54c396949f9 100644
--- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/IdentityProviderManagementServiceTest.java
+++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/IdentityProviderManagementServiceTest.java
@@ -37,6 +37,7 @@
import org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig;
import org.wso2.carbon.identity.application.common.model.RoleMapping;
import org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants;
+import org.wso2.carbon.identity.base.IdentityConstants;
import org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataManagementServiceImpl;
import org.wso2.carbon.identity.claim.metadata.mgt.exception.ClaimMetadataException;
import org.wso2.carbon.identity.claim.metadata.mgt.model.LocalClaim;
@@ -132,6 +133,7 @@ public Object[][] addIdPData() {
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
federatedAuthenticatorConfig.setEnabled(true);
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1 = new Property();
property1.setName("Property1");
property1.setValue("value1");
@@ -557,6 +559,7 @@ public Object[][] updateIdPData() {
newFederatedAuthenticatorConfig.setDisplayName("DisplayName1New");
newFederatedAuthenticatorConfig.setName("Name");
newFederatedAuthenticatorConfig.setEnabled(true);
+ newFederatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property newProperty1 = new Property();
newProperty1.setName("Property1New");
newProperty1.setValue("value1New");
@@ -796,6 +799,7 @@ public Object[][] updateResidentIdPData() {
facNew.setDisplayName("DisplayName1New");
facNew.setName("Name");
facNew.setEnabled(true);
+ facNew.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
idp2New.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[]{facNew});
// Initialize New Resident Identity Provider 3.
@@ -893,6 +897,7 @@ public void testGetResidentIDPMetadata() throws Exception {
facNew.setDisplayName("SAML2SSO");
facNew.setName("saml2sso");
facNew.setEnabled(true);
+ facNew.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
newIdp.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[]{facNew});
identityProviderManagementService.updateResidentIdP((IdentityProvider) newIdp);
@@ -915,6 +920,7 @@ public void testGetResidentIDPMetadataException() throws Exception {
facNew.setDisplayName("SAML2SSO");
facNew.setName("saml2sso");
facNew.setEnabled(true);
+ facNew.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
newIdp.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[]{facNew});
identityProviderManagementService.updateResidentIdP((IdentityProvider) newIdp);
@@ -950,6 +956,7 @@ private void addTestIdps() throws IdentityProviderManagementException {
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
federatedAuthenticatorConfig.setEnabled(true);
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1 = new Property();
property1.setName("Property1");
property1.setValue("value1");
@@ -1103,6 +1110,7 @@ private IdentityProvider addIdPDataWithSameIdpEntityId(String idpName) {
federatedAuthenticatorConfig.setDisplayName("DisplayName");
federatedAuthenticatorConfig.setName("SAMLSSOAuthenticator");
federatedAuthenticatorConfig.setEnabled(true);
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1 = new Property();
property1.setName("SPEntityId");
property1.setValue("wso2-is");
diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/dao/CacheBackedIdPMgtDAOTest.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/dao/CacheBackedIdPMgtDAOTest.java
index 853052a55842..1d00094a3b1a 100644
--- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/dao/CacheBackedIdPMgtDAOTest.java
+++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/dao/CacheBackedIdPMgtDAOTest.java
@@ -39,6 +39,7 @@
import org.wso2.carbon.identity.application.common.model.Property;
import org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig;
import org.wso2.carbon.identity.application.common.model.RoleMapping;
+import org.wso2.carbon.identity.base.IdentityConstants;
import org.wso2.carbon.identity.core.model.ExpressionNode;
import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
import org.wso2.carbon.identity.core.util.IdentityTenantUtil;
@@ -742,6 +743,7 @@ public Object[][] addIdPData() {
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
federatedAuthenticatorConfig.setEnabled(true);
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1 = new Property();
property1.setName("Property1");
property1.setValue("value1");
@@ -845,6 +847,7 @@ public Object[][] updateIdPData() {
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
federatedAuthenticatorConfig.setEnabled(true);
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1 = new Property();
property1.setName("Property1");
property1.setValue("value1");
@@ -902,6 +905,7 @@ public Object[][] updateIdPData() {
newFederatedAuthenticatorConfig.setDisplayName("DisplayName1New");
newFederatedAuthenticatorConfig.setName("Name");
newFederatedAuthenticatorConfig.setEnabled(true);
+ newFederatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1New = new Property();
property1New.setName("Property1New");
property1New.setValue("value1New");
@@ -1449,6 +1453,7 @@ private void addTestIdps() throws IdentityProviderManagementException {
FederatedAuthenticatorConfig federatedAuthenticatorConfig = new FederatedAuthenticatorConfig();
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
federatedAuthenticatorConfig.setEnabled(true);
Property property1 = new Property();
property1.setName("Property1");
diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAOTest.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAOTest.java
index e7b93e916790..f196b9a35447 100644
--- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAOTest.java
+++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAOTest.java
@@ -40,6 +40,7 @@
import org.wso2.carbon.identity.application.common.model.Property;
import org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig;
import org.wso2.carbon.identity.application.common.model.RoleMapping;
+import org.wso2.carbon.identity.base.IdentityConstants;
import org.wso2.carbon.identity.core.model.ExpressionNode;
import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
import org.wso2.carbon.identity.core.util.IdentityTenantUtil;
@@ -588,6 +589,7 @@ public Object[][] addIdPData() {
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
federatedAuthenticatorConfig.setEnabled(true);
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1 = new Property();
property1.setName("Property1");
property1.setValue("value1");
@@ -1104,6 +1106,7 @@ public Object[][] updateIdPData() {
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
federatedAuthenticatorConfig.setEnabled(true);
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1 = new Property();
property1.setName("Property1");
property1.setValue("value1");
@@ -1161,6 +1164,7 @@ public Object[][] updateIdPData() {
newFederatedAuthenticatorConfig.setDisplayName("DisplayName1New");
newFederatedAuthenticatorConfig.setName("Name");
newFederatedAuthenticatorConfig.setEnabled(true);
+ newFederatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1New = new Property();
property1New.setName("Property1New");
property1New.setValue("value1New");
@@ -1733,6 +1737,7 @@ private void addTestIdps() throws IdentityProviderManagementException {
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
federatedAuthenticatorConfig.setEnabled(true);
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1 = new Property();
property1.setName("Property1");
property1.setValue("value1");
@@ -1864,6 +1869,7 @@ private void addTestTrustedTokenIssuers() throws IdentityProviderManagementExcep
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
federatedAuthenticatorConfig.setEnabled(true);
+ federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
Property property1 = new Property();
property1.setName("Property1");
property1.setValue("value1");
diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/resources/dbscripts/h2.sql b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/resources/dbscripts/h2.sql
index 79494d2b9d30..dc2af66b4f82 100644
--- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/resources/dbscripts/h2.sql
+++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/test/resources/dbscripts/h2.sql
@@ -582,6 +582,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE);
diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql
index 7facf6a4d8a0..1b460105bd8a 100644
--- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql
+++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql
@@ -864,6 +864,7 @@ CREATE TABLE IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE)
diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql
index 6da58b00a5cd..05bd8716b096 100644
--- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql
+++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql
@@ -605,6 +605,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE);
diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql
index cc3ce1c9ad1e..96ec914e824c 100644
--- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql
+++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql
@@ -672,6 +672,7 @@ CREATE TABLE IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE
diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql
index 8e827ea7552d..f17118830358 100644
--- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql
+++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql
@@ -711,6 +711,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR(1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP (ID)
diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql
index f09ae2e4513b..2955b4581747 100644
--- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql
+++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql
@@ -624,6 +624,7 @@ CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE
diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql
index 6f9e84488ed2..9abf1c068f8c 100644
--- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql
+++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql
@@ -1001,6 +1001,7 @@ CREATE TABLE IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE)
diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql
index 8f06bfedecd9..deba4fac96f1 100644
--- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql
+++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql
@@ -883,6 +883,7 @@ CREATE TABLE IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE)
diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql
index 20793bca2de2..be4f0b8ee7be 100644
--- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql
+++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql
@@ -733,6 +733,7 @@ CREATE TABLE IDP_AUTHENTICATOR (
NAME VARCHAR(255) NOT NULL,
IS_ENABLED CHAR (1) DEFAULT '1',
DISPLAY_NAME VARCHAR(255),
+ DEFINED_BY VARCHAR(255) NOT NULL,
PRIMARY KEY (ID),
UNIQUE (TENANT_ID, IDP_ID, NAME),
FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE);
diff --git a/pom.xml b/pom.xml
index 7cf440b0b873..615ae2336d93 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2153,7 +2153,7 @@
71.1
3.1.0
- 4.8.4.0
+ 4.8.1.0
[1.4.23, 2.0.0)
15.3