From e80bd5c098aab0765b0e3dde432cb2201966f18c Mon Sep 17 00:00:00 2001 From: thisarawelmilla Date: Fri, 4 Oct 2024 10:46:50 +0530 Subject: [PATCH 1/2] Add definedBy type property. --- .../model/FederatedAuthenticatorConfig.java | 35 ++++++++++++++++++ .../model/LocalAuthenticatorConfig.java | 36 +++++++++++++++++++ .../model/RequestPathAuthenticatorConfig.java | 5 +++ .../framework/ApplicationAuthenticator.java | 10 ++++++ .../internal/FrameworkServiceComponent.java | 4 +++ .../framework/util/FrameworkUtils.java | 18 ++++++++++ .../base/AuthenticatorPropertiesConstant.java | 31 ++++++++++++++++ .../idp/mgt/IdentityProviderManager.java | 4 +++ 8 files changed, 143 insertions(+) create mode 100644 components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertiesConstant.java 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..bb00892655f8 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,9 @@ import org.apache.axiom.om.OMElement; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType; import java.io.Serializable; import java.util.ArrayList; @@ -46,6 +49,7 @@ public class FederatedAuthenticatorConfig implements Serializable { private static final long serialVersionUID = -2361107623257323257L; + private static final Logger LOG = LoggerFactory.getLogger(LocalAuthenticatorConfig.class); @XmlElement(name = "Name") protected String name; @@ -63,6 +67,9 @@ public class FederatedAuthenticatorConfig implements Serializable { @XmlElement(name = "Tags") protected String[] tags; + @XmlElement(name = "DefinedBy") + protected DefinedByType definedByType; + public static FederatedAuthenticatorConfig build(OMElement federatedAuthenticatorConfigOM) { if (federatedAuthenticatorConfigOM == null) { @@ -101,9 +108,17 @@ public static FederatedAuthenticatorConfig build(OMElement federatedAuthenticato Property[] propertiesArr = propertiesArrList.toArray(new Property[propertiesArrList.size()]); federatedAuthenticatorConfig.setProperties(propertiesArr); } + } else if ("DefinedBy".equals(elementName)) { + federatedAuthenticatorConfig.setDefinedByType(DefinedByType.valueOf(element.getText())); } } + if (federatedAuthenticatorConfig.getDefinedByType() == null) { + federatedAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM); + LOG.debug("The defined by type is not set for the {}. Hence setting default SYSTEM value.", + federatedAuthenticatorConfig.getName()); + } + return federatedAuthenticatorConfig; } @@ -230,4 +245,24 @@ public void setTags(String[] tagList) { tags = tagList; } + + /** + * Get the defined by type of the federated authenticator config. + * + * @return DefinedByType + */ + public DefinedByType getDefinedByType() { + + return definedByType; + } + + /** + * Set the defined by type of the federated authenticator config. + * + * @param type The defined by type of the federated authenticator config. + */ + public void setDefinedByType(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..aa8132987806 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 @@ -22,6 +22,9 @@ import org.apache.axiom.om.OMElement; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType; import org.wso2.carbon.identity.base.IdentityConstants; import java.io.Serializable; @@ -46,6 +49,7 @@ public class LocalAuthenticatorConfig implements Serializable { private static final long serialVersionUID = 3363298518257599291L; + private static final Logger LOG = LoggerFactory.getLogger(LocalAuthenticatorConfig.class); @XmlElement(name = "Name") protected String name; @@ -63,6 +67,9 @@ public class LocalAuthenticatorConfig implements Serializable { @XmlElement(name = "Tags") protected String[] tags; + @XmlElement(name = "DefinedBy") + protected DefinedByType definedByType; + /* * * @@ -111,8 +118,17 @@ public static LocalAuthenticatorConfig build(OMElement localAuthenticatorConfigO Property[] propertiesArr = propertiesArrList.toArray(new Property[0]); localAuthenticatorConfig.setProperties(propertiesArr); } + } else if ("DefinedBy".equals(member.getLocalName())) { + localAuthenticatorConfig.setDefinedByType(DefinedByType.valueOf(member.getText())); } } + + if (localAuthenticatorConfig.getDefinedByType() == null) { + localAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM); + LOG.debug("The defined by type is not set for the {}. Hence setting default SYSTEM value.", + localAuthenticatorConfig.getName()); + } + return localAuthenticatorConfig; } @@ -224,4 +240,24 @@ public void setTags(String[] tagList) { tags = tagList; } + + /** + * Get the defined by type of the Local authenticator config. + * + * @return DefinedByType + */ + public DefinedByType getDefinedByType() { + + return definedByType; + } + + /** + * Set the defined by type of the Local authenticator config. + * + * @param type The defined by type of the local authenticator config. + */ + public void setDefinedByType(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/RequestPathAuthenticatorConfig.java b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/RequestPathAuthenticatorConfig.java index 0da3dc5a37a1..e1ebff27f67f 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/RequestPathAuthenticatorConfig.java +++ b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/RequestPathAuthenticatorConfig.java @@ -20,6 +20,7 @@ import org.apache.axiom.om.OMElement; import org.apache.commons.collections.CollectionUtils; +import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant; import java.util.ArrayList; import java.util.Iterator; @@ -74,6 +75,10 @@ public static RequestPathAuthenticatorConfig build(OMElement requestPathAuthenti } } } + + // Since custom request path authenticators are not allowed, the definedBy type will always be set to SYSTEM. + requestPathAuthenticatorConfig.setDefinedByType(AuthenticatorPropertiesConstant.DefinedByType.SYSTEM); + return requestPathAuthenticatorConfig; } 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..54fc04e2440f 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.AuthenticatorPropertiesConstant.DefinedByType; 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 DefinedByType getDefinedByType() { + + return 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..74e898169db3 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.AuthenticatorPropertiesConstant.DefinedByType; 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; @@ -508,6 +509,7 @@ protected void setAuthenticator(ApplicationAuthenticator authenticator) { localAuthenticatorConfig.setTags(getTags(authenticator)); AuthenticatorConfig fileBasedConfig = getAuthenticatorConfig(authenticator.getName()); localAuthenticatorConfig.setEnabled(fileBasedConfig.isEnabled()); + localAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM); ApplicationAuthenticatorService.getInstance().addLocalAuthenticator(localAuthenticatorConfig); } else if (authenticator instanceof FederatedApplicationAuthenticator) { FederatedAuthenticatorConfig federatedAuthenticatorConfig = new FederatedAuthenticatorConfig(); @@ -515,6 +517,7 @@ protected void setAuthenticator(ApplicationAuthenticator authenticator) { federatedAuthenticatorConfig.setProperties(configProperties); federatedAuthenticatorConfig.setDisplayName(authenticator.getFriendlyName()); federatedAuthenticatorConfig.setTags(getTags(authenticator)); + federatedAuthenticatorConfig.setDefinedByType(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(DefinedByType.SYSTEM); ApplicationAuthenticatorService.getInstance().addRequestPathAuthenticator(reqPathAuthenticatorConfig); } 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..4679d8fbfe7a 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.AuthenticatorPropertiesConstant.DefinedByType; 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,21 @@ 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. + */ + public static DefinedByType getAuthenticatorDefinedByType(String authenticatorName) { + + for (ApplicationAuthenticator authenticator: FrameworkServiceComponent.getAuthenticators()) { + if (authenticator.getName().equals(authenticatorName)) { + return authenticator.getDefinedByType(); + } + } + + return null; + } } diff --git a/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertiesConstant.java b/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertiesConstant.java new file mode 100644 index 000000000000..912ac754fb07 --- /dev/null +++ b/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertiesConstant.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.base; + +public class AuthenticatorPropertiesConstant { + + /** + * The Defined by Types - SYSTEM: system define authenticator, USER: 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/IdentityProviderManager.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/IdentityProviderManager.java index c383da9a34ff..bef916df3371 100644 --- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/IdentityProviderManager.java +++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/IdentityProviderManager.java @@ -43,6 +43,7 @@ import org.wso2.carbon.identity.application.common.model.SubProperty; import org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants; import org.wso2.carbon.identity.application.common.util.IdentityApplicationManagementUtil; +import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType; import org.wso2.carbon.identity.base.IdentityConstants; import org.wso2.carbon.identity.base.IdentityException; import org.wso2.carbon.identity.core.ServiceURLBuilder; @@ -171,6 +172,7 @@ public void addResidentIdP(IdentityProvider identityProvider, String tenantDomai if (saml2SSOResidentAuthenticatorConfig == null) { saml2SSOResidentAuthenticatorConfig = new FederatedAuthenticatorConfig(); saml2SSOResidentAuthenticatorConfig.setName(IdentityApplicationConstants.Authenticator.SAML2SSO.NAME); + saml2SSOResidentAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM); } if (saml2SSOResidentAuthenticatorConfig.getProperties() == null) { saml2SSOResidentAuthenticatorConfig.setProperties(new Property[0]); @@ -255,6 +257,7 @@ public void addResidentIdP(IdentityProvider identityProvider, String tenantDomai FederatedAuthenticatorConfig oidcAuthenticationConfig = new FederatedAuthenticatorConfig(); oidcAuthenticationConfig.setProperties(new Property[]{oidcProperty}); oidcAuthenticationConfig.setName(IdentityApplicationConstants.Authenticator.OIDC.NAME); + oidcAuthenticationConfig.setDefinedByType(DefinedByType.SYSTEM); Property passiveStsProperty = new Property(); passiveStsProperty.setName(IdentityApplicationConstants.Authenticator.PassiveSTS.IDENTITY_PROVIDER_ENTITY_ID); @@ -263,6 +266,7 @@ public void addResidentIdP(IdentityProvider identityProvider, String tenantDomai FederatedAuthenticatorConfig passiveStsAuthenticationConfig = new FederatedAuthenticatorConfig(); passiveStsAuthenticationConfig.setProperties(new Property[]{passiveStsProperty}); passiveStsAuthenticationConfig.setName(IdentityApplicationConstants.Authenticator.PassiveSTS.NAME); + passiveStsAuthenticationConfig.setDefinedByType(DefinedByType.SYSTEM); FederatedAuthenticatorConfig[] federatedAuthenticatorConfigs = {saml2SSOResidentAuthenticatorConfig, passiveStsAuthenticationConfig, oidcAuthenticationConfig}; From eb2ca3b47deadde8a998a5b15fb61938f3234798 Mon Sep 17 00:00:00 2001 From: thisarawelmilla Date: Mon, 7 Oct 2024 20:58:35 +0530 Subject: [PATCH 2/2] Address comments --- .../model/FederatedAuthenticatorConfig.java | 7 +------ .../common/model/LocalAuthenticatorConfig.java | 7 +------ .../model/RequestPathAuthenticatorConfig.java | 4 ++-- .../framework/ApplicationAuthenticator.java | 2 +- .../internal/FrameworkServiceComponent.java | 2 +- .../framework/util/FrameworkUtils.java | 18 ------------------ ...ava => AuthenticatorPropertyConstants.java} | 2 +- .../idp/mgt/IdentityProviderManager.java | 15 +-------------- 8 files changed, 8 insertions(+), 49 deletions(-) rename components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/{AuthenticatorPropertiesConstant.java => AuthenticatorPropertyConstants.java} (94%) 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 bb00892655f8..7805ecfd177f 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,9 +22,7 @@ import org.apache.axiom.om.OMElement; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType; +import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants.DefinedByType; import java.io.Serializable; import java.util.ArrayList; @@ -49,7 +47,6 @@ public class FederatedAuthenticatorConfig implements Serializable { private static final long serialVersionUID = -2361107623257323257L; - private static final Logger LOG = LoggerFactory.getLogger(LocalAuthenticatorConfig.class); @XmlElement(name = "Name") protected String name; @@ -115,8 +112,6 @@ public static FederatedAuthenticatorConfig build(OMElement federatedAuthenticato if (federatedAuthenticatorConfig.getDefinedByType() == null) { federatedAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM); - LOG.debug("The defined by type is not set for the {}. Hence setting default SYSTEM value.", - federatedAuthenticatorConfig.getName()); } return federatedAuthenticatorConfig; 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 aa8132987806..89e09a467774 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 @@ -22,9 +22,7 @@ import org.apache.axiom.om.OMElement; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType; +import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants.DefinedByType; import org.wso2.carbon.identity.base.IdentityConstants; import java.io.Serializable; @@ -49,7 +47,6 @@ public class LocalAuthenticatorConfig implements Serializable { private static final long serialVersionUID = 3363298518257599291L; - private static final Logger LOG = LoggerFactory.getLogger(LocalAuthenticatorConfig.class); @XmlElement(name = "Name") protected String name; @@ -125,8 +122,6 @@ public static LocalAuthenticatorConfig build(OMElement localAuthenticatorConfigO if (localAuthenticatorConfig.getDefinedByType() == null) { localAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM); - LOG.debug("The defined by type is not set for the {}. Hence setting default SYSTEM value.", - localAuthenticatorConfig.getName()); } return localAuthenticatorConfig; diff --git a/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/RequestPathAuthenticatorConfig.java b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/RequestPathAuthenticatorConfig.java index e1ebff27f67f..6e56cf90bade 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/RequestPathAuthenticatorConfig.java +++ b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/RequestPathAuthenticatorConfig.java @@ -20,7 +20,7 @@ import org.apache.axiom.om.OMElement; import org.apache.commons.collections.CollectionUtils; -import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant; +import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants; import java.util.ArrayList; import java.util.Iterator; @@ -77,7 +77,7 @@ public static RequestPathAuthenticatorConfig build(OMElement requestPathAuthenti } // Since custom request path authenticators are not allowed, the definedBy type will always be set to SYSTEM. - requestPathAuthenticatorConfig.setDefinedByType(AuthenticatorPropertiesConstant.DefinedByType.SYSTEM); + requestPathAuthenticatorConfig.setDefinedByType(AuthenticatorPropertyConstants.DefinedByType.SYSTEM); return requestPathAuthenticatorConfig; } 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 54fc04e2440f..fe89fd929b3d 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,7 +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.AuthenticatorPropertiesConstant.DefinedByType; +import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants.DefinedByType; import java.io.Serializable; import java.util.List; 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 74e898169db3..42ecadb98176 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,7 +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.AuthenticatorPropertiesConstant.DefinedByType; +import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants.DefinedByType; 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; 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 4679d8fbfe7a..054821bc69bd 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,7 +115,6 @@ 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.AuthenticatorPropertiesConstant.DefinedByType; import org.wso2.carbon.identity.base.IdentityException; import org.wso2.carbon.identity.base.IdentityRuntimeException; import org.wso2.carbon.identity.central.log.mgt.utils.LoggerUtils; @@ -4191,21 +4190,4 @@ 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. - */ - public static DefinedByType getAuthenticatorDefinedByType(String authenticatorName) { - - for (ApplicationAuthenticator authenticator: FrameworkServiceComponent.getAuthenticators()) { - if (authenticator.getName().equals(authenticatorName)) { - return authenticator.getDefinedByType(); - } - } - - return null; - } } diff --git a/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertiesConstant.java b/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertyConstants.java similarity index 94% rename from components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertiesConstant.java rename to components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertyConstants.java index 912ac754fb07..e7852cea8b4b 100644 --- a/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertiesConstant.java +++ b/components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/AuthenticatorPropertyConstants.java @@ -18,7 +18,7 @@ package org.wso2.carbon.identity.base; -public class AuthenticatorPropertiesConstant { +public class AuthenticatorPropertyConstants { /** * The Defined by Types - SYSTEM: system define authenticator, USER: user defined authentication extension. diff --git a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/IdentityProviderManager.java b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/IdentityProviderManager.java index bef916df3371..28d969c61d75 100644 --- a/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/IdentityProviderManager.java +++ b/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/IdentityProviderManager.java @@ -18,15 +18,12 @@ package org.wso2.carbon.idp.mgt; -import org.apache.axiom.om.util.Base64; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.core.util.KeyStoreManager; import org.wso2.carbon.identity.application.common.ApplicationAuthenticatorService; import org.wso2.carbon.identity.application.common.ProvisioningConnectorService; import org.wso2.carbon.identity.application.common.model.ClaimConfig; @@ -43,11 +40,9 @@ import org.wso2.carbon.identity.application.common.model.SubProperty; import org.wso2.carbon.identity.application.common.util.IdentityApplicationConstants; import org.wso2.carbon.identity.application.common.util.IdentityApplicationManagementUtil; -import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType; +import org.wso2.carbon.identity.base.AuthenticatorPropertyConstants.DefinedByType; import org.wso2.carbon.identity.base.IdentityConstants; import org.wso2.carbon.identity.base.IdentityException; -import org.wso2.carbon.identity.core.ServiceURLBuilder; -import org.wso2.carbon.identity.core.URLBuilderException; import org.wso2.carbon.identity.core.model.ExpressionNode; import org.wso2.carbon.identity.core.model.FilterTreeBuilder; import org.wso2.carbon.identity.core.model.Node; @@ -71,15 +66,8 @@ import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.core.UserCoreConstants; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import org.wso2.carbon.utils.security.KeystoreUtils; import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.security.KeyStore; -import java.security.cert.CertificateEncodingException; -import java.security.cert.X509Certificate; import java.sql.Connection; import java.util.ArrayList; import java.util.Arrays; @@ -90,7 +78,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; import java.util.stream.Stream; import javax.xml.stream.XMLStreamException;