diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/cache/AuthenticationContextLoader.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/cache/AuthenticationContextLoader.java index e63157d7e730..fd4426586df6 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/cache/AuthenticationContextLoader.java +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/cache/AuthenticationContextLoader.java @@ -39,6 +39,7 @@ import org.wso2.carbon.identity.application.common.model.IdentityProvider; import org.wso2.carbon.identity.application.common.model.ServiceProvider; import org.wso2.carbon.identity.application.mgt.ApplicationManagementServiceImpl; +import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants; import org.wso2.carbon.idp.mgt.IdentityProviderManagementClientException; import org.wso2.carbon.idp.mgt.IdentityProviderManagementException; import org.wso2.carbon.idp.mgt.IdentityProviderManagementServerException; @@ -140,7 +141,10 @@ private void optimizeAuthenticatorConfig(AuthenticationContext context) List authenticatorList = stepConfig.getAuthenticatorList(); for (AuthenticatorConfig authenticatorConfig : authenticatorList) { authenticatorConfig.setIdPResourceIds(Collections.emptyList()); - authenticatorConfig.setApplicationAuthenticator(null); + if (AuthenticatorPropertyConstants.DefinedByType.SYSTEM.equals( + authenticatorConfig.getApplicationAuthenticator().getDefinedByType())) { + authenticatorConfig.setApplicationAuthenticator(null); + } List idPResourceId = new ArrayList<>(); if (authenticatorConfig.getIdps() != null) { for (Map.Entry entry : authenticatorConfig.getIdps().entrySet()) {