diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java index 054821bc69bd..f6775e77740d 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java @@ -115,6 +115,7 @@ import org.wso2.carbon.identity.application.common.model.Property; import org.wso2.carbon.identity.application.common.model.ServiceProvider; import org.wso2.carbon.identity.application.mgt.ApplicationConstants; +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.central.log.mgt.utils.LoggerUtils; @@ -4190,4 +4191,23 @@ public static boolean isURLRelative(String uriString) throws URISyntaxException return !new URI(uriString).isAbsolute(); } + + /** + * This method return defined by type for the given authenticator name. + * + * @param authenticatorName Name of the authenticator. + * @return The defined by type. + * @throws FrameworkException If no authenticator found for the given authenticator name. + */ + public static IdentityConstants.DefinedByType getAuthenticatorDefinedByType(String authenticatorName) + throws FrameworkException { + + for (ApplicationAuthenticator authenticator: FrameworkServiceComponent.getAuthenticators()) { + if (authenticator.getName().equals(authenticatorName)) { + return authenticator.getDefinedByType(); + } + } + + throw new FrameworkException("No authenticator instance is found for " + authenticatorName); + } }