Skip to content

Commit

Permalink
Comments addressed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisara-Welmilla committed Oct 4, 2024
1 parent 707060a commit 32e7a86
Show file tree
Hide file tree
Showing 17 changed files with 189 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.identity.base.IdentityConstants;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.AuthenticationType;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType;

import java.io.Serializable;
import java.util.ArrayList;
Expand Down Expand Up @@ -68,10 +69,10 @@ public class FederatedAuthenticatorConfig implements Serializable {
protected String[] tags;

@XmlElement(name = "DefinedBy")
protected IdentityConstants.DefinedByType definedByType;
protected DefinedByType definedByType;

@XmlElement(name = "AuthenticationType")
protected IdentityConstants.AuthenticationType authenticationType;
protected AuthenticationType authenticationType;

public static FederatedAuthenticatorConfig build(OMElement federatedAuthenticatorConfigOM) {

Expand Down Expand Up @@ -113,15 +114,14 @@ public static FederatedAuthenticatorConfig build(OMElement federatedAuthenticato
}
} else if ("DefinedBy".equals(elementName)) {
federatedAuthenticatorConfig.setDefinedByType(
IdentityConstants.DefinedByType.valueOf(element.getText()));
DefinedByType.valueOf(element.getText()));

Check warning on line 117 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java#L116-L117

Added lines #L116 - L117 were not covered by tests
}
}

if (federatedAuthenticatorConfig.getDefinedByType() == null) {
federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
LOG.debug("The defined by type is not set for the : " + federatedAuthenticatorConfig.getName());
federatedAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM);

Check warning on line 122 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java#L122

Added line #L122 was not covered by tests
}
federatedAuthenticatorConfig.setAuthenticationType(IdentityConstants.AuthenticationType.IDENTIFICATION);
federatedAuthenticatorConfig.setAuthenticationType(AuthenticationType.IDENTIFICATION);

Check warning on line 124 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java#L124

Added line #L124 was not covered by tests

return federatedAuthenticatorConfig;
}
Expand Down Expand Up @@ -253,9 +253,9 @@ public void setTags(String[] tagList) {
/**
* Get the defined by type of the federated authenticator config.
*
* @return IdentityConstants.DefinedByType
* @return DefinedByType
*/
public IdentityConstants.DefinedByType getDefinedByType() {
public DefinedByType getDefinedByType() {

return definedByType;

Check warning on line 260 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java#L260

Added line #L260 was not covered by tests
}
Expand All @@ -265,17 +265,17 @@ public IdentityConstants.DefinedByType getDefinedByType() {
*
* @param type The defined by type of the authenticator config.
*/
public void setDefinedByType(IdentityConstants.DefinedByType type) {
public void setDefinedByType(DefinedByType type) {

definedByType = type;
}

Check warning on line 271 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java#L270-L271

Added lines #L270 - L271 were not covered by tests

/**
* Get the authentication type of the federated authenticator config.
*
* @return IdentityConstants.AuthenticationType
* @return AuthenticationType
*/
public IdentityConstants.AuthenticationType getAuthenticationType() {
public AuthenticationType getAuthenticationType() {

return authenticationType;

Check warning on line 280 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java#L280

Added line #L280 was not covered by tests
}
Expand All @@ -285,7 +285,7 @@ public IdentityConstants.AuthenticationType getAuthenticationType() {
*
* @param type The authentication type.
*/
public void setAuthenticationType(IdentityConstants.AuthenticationType type) {
public void setAuthenticationType(AuthenticationType type) {

authenticationType = type;
}

Check warning on line 291 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/FederatedAuthenticatorConfig.java#L290-L291

Added lines #L290 - L291 were not covered by tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.AuthenticationType;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType;
import org.wso2.carbon.identity.base.IdentityConstants;

import java.io.Serializable;
Expand Down Expand Up @@ -69,10 +71,10 @@ public class LocalAuthenticatorConfig implements Serializable {
protected String[] tags;

@XmlElement(name = "DefinedBy")
protected IdentityConstants.DefinedByType definedByType;
protected DefinedByType definedByType;

@XmlElement(name = "AuthenticationType")
protected IdentityConstants.AuthenticationType authenticationType;
protected AuthenticationType authenticationType;

/*
* <LocalAuthenticatorConfig> <Name></Name> <DisplayName></DisplayName> <IsEnabled></IsEnabled>
Expand Down Expand Up @@ -123,25 +125,25 @@ public static LocalAuthenticatorConfig build(OMElement localAuthenticatorConfigO
localAuthenticatorConfig.setProperties(propertiesArr);
}
} else if ("DefinedBy".equals(member.getLocalName())) {
localAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.valueOf(member.getText()));
localAuthenticatorConfig.setDefinedByType(DefinedByType.valueOf(member.getText()));

Check warning on line 128 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L128

Added line #L128 was not covered by tests
} else if ("AuthenticationType".equals(member.getLocalName())) {
localAuthenticatorConfig.setAuthenticationType(
IdentityConstants.AuthenticationType.valueOf(member.getText()));
AuthenticationType.valueOf(member.getText()));

Check warning on line 131 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L130-L131

Added lines #L130 - L131 were not covered by tests
}
}

Check warning on line 133 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L133

Added line #L133 was not covered by tests

if (localAuthenticatorConfig.getDefinedByType() == null) {
localAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
localAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM);
LOG.debug("The defined by type is not set for the {}. Hence setting default SYSTEM value.",
localAuthenticatorConfig.getName());

Check warning on line 138 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L136-L138

Added lines #L136 - L138 were not covered by tests
}
if (localAuthenticatorConfig.getAuthenticationType() == null && localAuthenticatorConfig.getTags() != null) {
if (localAuthenticatorConfig.getTags() != null &&
Arrays.stream(localAuthenticatorConfig.getTags()).anyMatch(s -> s.equalsIgnoreCase(TAG_2FA))) {
localAuthenticatorConfig.setAuthenticationType(

Check warning on line 143 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L143

Added line #L143 was not covered by tests
IdentityConstants.AuthenticationType.VERIFICATION_ONLY);
AuthenticationType.VERIFICATION_ONLY);
} else {
localAuthenticatorConfig.setAuthenticationType(IdentityConstants.AuthenticationType.IDENTIFICATION);
localAuthenticatorConfig.setAuthenticationType(AuthenticationType.IDENTIFICATION);

Check warning on line 146 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L146

Added line #L146 was not covered by tests
}
LOG.debug("The defined by type is not set for the: {}. Hence setting value based on the factor for the: {}",
localAuthenticatorConfig.getName(), localAuthenticatorConfig.getAuthenticationType().toString());

Check warning on line 149 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L148-L149

Added lines #L148 - L149 were not covered by tests
Expand Down Expand Up @@ -262,9 +264,9 @@ public void setTags(String[] tagList) {
/**
* Get the defined by type of the Local authenticator config.
*
* @return IdentityConstants.DefinedByType
* @return DefinedByType
*/
public IdentityConstants.DefinedByType getDefinedByType() {
public DefinedByType getDefinedByType() {

return definedByType;

Check warning on line 271 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L271

Added line #L271 was not covered by tests
}
Expand All @@ -274,17 +276,17 @@ public IdentityConstants.DefinedByType getDefinedByType() {
*
* @param type The defined by type of the authenticator config.
*/
public void setDefinedByType(IdentityConstants.DefinedByType type) {
public void setDefinedByType(DefinedByType type) {

definedByType = type;
}

Check warning on line 282 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L281-L282

Added lines #L281 - L282 were not covered by tests

/**
* Get the authentication type of the Local authenticator config .
*
* @return IdentityConstants.AuthenticationType
* @return AuthenticationType
*/
public IdentityConstants.AuthenticationType getAuthenticationType() {
public AuthenticationType getAuthenticationType() {

return authenticationType;

Check warning on line 291 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L291

Added line #L291 was not covered by tests
}
Expand All @@ -294,7 +296,7 @@ public IdentityConstants.AuthenticationType getAuthenticationType() {
*
* @param type The authentication type.
*/
public void setAuthenticationType(IdentityConstants.AuthenticationType type) {
public void setAuthenticationType(AuthenticationType type) {

authenticationType = type;
}

Check warning on line 302 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/LocalAuthenticatorConfig.java#L301-L302

Added lines #L301 - L302 were not covered by tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import org.apache.axiom.om.OMElement;
import org.apache.commons.collections.CollectionUtils;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.AuthenticationType;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType;

import java.util.ArrayList;
import java.util.Iterator;
Expand Down Expand Up @@ -74,6 +76,10 @@ public static RequestPathAuthenticatorConfig build(OMElement requestPathAuthenti
}
}
}

requestPathAuthenticatorConfig.setAuthenticationType(AuthenticationType.REQUEST_PATH);
requestPathAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM);

Check warning on line 81 in components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/RequestPathAuthenticatorConfig.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/RequestPathAuthenticatorConfig.java#L80-L81

Added lines #L80 - L81 were not covered by tests

return requestPathAuthenticatorConfig;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
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.AuthenticatorPropertiesConstant.AuthenticationType;
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.core.CertificateRetrievingException;
Expand Down Expand Up @@ -1568,14 +1569,12 @@ private void updateLocalAndOutboundAuthenticationConfiguration(int applicationId
lclAuthenticator.getName(),
lclAuthenticator.getDisplayName());
} else {
if (lclAuthenticator.getDefinedByType() == null) {
log.debug("Authenticator already exists. Updating the authenticator, but the " +
"defined by type is not set.");
} else {
log.debug("Authenticator already exists. Updating the authenticator.The defined "
/* On demand migration for already saved local authenticators to save definedBy and
authenticationType properties to the database.
Remove this else block, once on-demand migration is done.*/
log.debug("Authenticator already exists. Updating the authenticator.The defined "
+ "by type is set to: " + lclAuthenticator.getDefinedByType().toString());

Check warning on line 1576 in components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java#L1575-L1576

Added lines #L1575 - L1576 were not covered by tests
//TODO: Update database with defined by properties for local authenticators.
}
//TODO: Update database with defined by properties for local authenticators.
}
if (authenticatorId > 0) {
// ID, TENANT_ID, AUTHENTICATOR_ID
Expand Down Expand Up @@ -3098,9 +3097,9 @@ private LocalAndOutboundAuthenticationConfig getLocalAndOutboundAuthenticationCo
.get(ApplicationConstants.IDP_AUTHENTICATOR_NAME));
localAuthenticator.setDisplayName(authenticatorInfo
.get(ApplicationConstants.IDP_AUTHENTICATOR_DISPLAY_NAME));
localAuthenticator.setDefinedByType(IdentityConstants.DefinedByType.valueOf(
localAuthenticator.setDefinedByType(DefinedByType.valueOf(
authenticatorInfo.get(ApplicationConstants.IDP_AUTHENTICATOR_DEFINED_BY_TYPE)));
localAuthenticator.setAuthenticationType(IdentityConstants.AuthenticationType.valueOf(
localAuthenticator.setAuthenticationType(AuthenticationType.valueOf(
authenticatorInfo.get(ApplicationConstants.IDP_AUTHENTICATOR_AUTHENTICATION_TYPE)));

Check warning on line 3103 in components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java

View check run for this annotation

Codecov / codecov/patch

components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java#L3100-L3103

Added lines #L3100 - L3103 were not covered by tests
stepLocalAuth.get(step).add(localAuthenticator);
} else {
Expand All @@ -3120,9 +3119,9 @@ private LocalAndOutboundAuthenticationConfig getLocalAndOutboundAuthenticationCo
.get(ApplicationConstants.IDP_AUTHENTICATOR_NAME));
fedAuthenticator.setDisplayName(authenticatorInfo
.get(ApplicationConstants.IDP_AUTHENTICATOR_DISPLAY_NAME));
fedAuthenticator.setDefinedByType(IdentityConstants.DefinedByType.valueOf(
fedAuthenticator.setDefinedByType(DefinedByType.valueOf(
authenticatorInfo.get(ApplicationConstants.IDP_AUTHENTICATOR_DEFINED_BY_TYPE)));
fedAuthenticator.setAuthenticationType(IdentityConstants.AuthenticationType.IDENTIFICATION);
fedAuthenticator.setAuthenticationType(AuthenticationType.IDENTIFICATION);
idpAuths.add(fedAuthenticator);
}

Expand Down Expand Up @@ -5036,7 +5035,9 @@ private Map<String, String> getAuthenticatorInfo(Connection conn, int tenantId,
}
// TODO: Read from database and set the DefinedBy and authenticationType properties to the authenticator.
returnData.put(ApplicationConstants.IDP_AUTHENTICATOR_DEFINED_BY_TYPE,
IdentityConstants.DefinedByType.SYSTEM.toString());
DefinedByType.SYSTEM.toString());
returnData.put(ApplicationConstants.IDP_AUTHENTICATOR_AUTHENTICATION_TYPE,
AuthenticationType.IDENTIFICATION.toString());
} finally {
IdentityApplicationManagementUtil.closeStatement(prepStmt);
}
Expand Down Expand Up @@ -5070,8 +5071,8 @@ private int addAuthenticator(Connection conn, int tenantId, String idpName,
prepStmt.setString(4, authenticatorName);
prepStmt.setString(5, "1");
prepStmt.setString(6, authenticatorDispalyName);
//TODO: prepStmt.setString(7, IdentityConstants.DefinedByType.SYSTEM.toString());
//TODO: prepStmt.setString(8, IdentityConstants.AuthenticationType.<TYPE>.toString());
//TODO: prepStmt.setString(7, DefinedByType.SYSTEM.toString());
//TODO: prepStmt.setString(8, AuthenticationType.<TYPE>.toString());
prepStmt.execute();
rs = prepStmt.getGeneratedKeys();
if (rs.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
import org.wso2.carbon.identity.application.mgt.internal.ApplicationManagementServiceComponentHolder;
import org.wso2.carbon.identity.application.mgt.provider.ApplicationPermissionProvider;
import org.wso2.carbon.identity.application.mgt.provider.RegistryBasedApplicationPermissionProvider;
import org.wso2.carbon.identity.base.IdentityConstants;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.AuthenticationType;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType;
import org.wso2.carbon.identity.common.testng.WithH2Database;
import org.wso2.carbon.identity.common.testng.realm.InMemoryRealmService;
import org.wso2.carbon.identity.common.testng.realm.MockUserStoreManager;
Expand Down Expand Up @@ -673,12 +674,14 @@ public void testGetConfiguredAuthenticators() throws IdentityApplicationManageme
for (AuthenticationStep step : steps) {
LocalAuthenticatorConfig[] localAuthenticators = step.getLocalAuthenticatorConfigs();
for (LocalAuthenticatorConfig localConfig : localAuthenticators) {
Assert.assertNotNull(localConfig.getDefinedByType());
Assert.assertEquals(localConfig.getDefinedByType(), DefinedByType.SYSTEM);
Assert.assertEquals(localConfig.getAuthenticationType(), AuthenticationType.IDENTIFICATION);
}
IdentityProvider[] identityProviders = step.getFederatedIdentityProviders();
for (IdentityProvider idp : identityProviders) {
for (FederatedAuthenticatorConfig fedConfig: idp.getFederatedAuthenticatorConfigs()) {
Assert.assertNotNull(fedConfig.getDefinedByType());
Assert.assertEquals(fedConfig.getDefinedByType(), DefinedByType.SYSTEM);
Assert.assertEquals(fedConfig.getAuthenticationType(), AuthenticationType.IDENTIFICATION);
}
}
}
Expand Down Expand Up @@ -1314,13 +1317,15 @@ private void addApplicationConfigurations(ServiceProvider serviceProvider) {
identityProvider.setIdentityProviderName(IDP_NAME_1);
FederatedAuthenticatorConfig federatedAuthenticatorConfig = new FederatedAuthenticatorConfig();
federatedAuthenticatorConfig.setName("Federated authenticator");
federatedAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
federatedAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM);
federatedAuthenticatorConfig.setAuthenticationType(AuthenticationType.IDENTIFICATION);
identityProvider.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[]
{federatedAuthenticatorConfig});
authenticationStep.setFederatedIdentityProviders(new IdentityProvider[]{identityProvider});
LocalAuthenticatorConfig localAuthenticatorConfig = new LocalAuthenticatorConfig();
localAuthenticatorConfig.setName("Local authenticator");
localAuthenticatorConfig.setDefinedByType(IdentityConstants.DefinedByType.SYSTEM);
localAuthenticatorConfig.setDefinedByType(DefinedByType.SYSTEM);
federatedAuthenticatorConfig.setAuthenticationType(AuthenticationType.IDENTIFICATION);
authenticationStep.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[]{localAuthenticatorConfig});
authenticationConfig.setAuthenticationSteps(new AuthenticationStep[]{authenticationStep});
serviceProvider.setLocalAndOutBoundAuthenticationConfig(authenticationConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
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 org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.AuthenticationType;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.DefinedByType;

import java.io.Serializable;
import java.util.List;
Expand Down Expand Up @@ -177,18 +178,18 @@ default String getI18nKey() {
*
* @return Authenticator Type.
*/
default IdentityConstants.DefinedByType getDefinedByType() {
default DefinedByType getDefinedByType() {

return IdentityConstants.DefinedByType.SYSTEM;
return DefinedByType.SYSTEM;

Check warning on line 183 in components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/ApplicationAuthenticator.java

View check run for this annotation

Codecov / codecov/patch

components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/ApplicationAuthenticator.java#L183

Added line #L183 was not covered by tests
}

/**
* Get the authenticator type. Default value will be SYSTEM.
*
* @return Authenticator Type.
*/
default IdentityConstants.AuthenticationType getAuthenticationType() {
default AuthenticationType getAuthenticationType() {

return null;
return AuthenticationType.IDENTIFICATION;

Check warning on line 193 in components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/ApplicationAuthenticator.java

View check run for this annotation

Codecov / codecov/patch

components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/ApplicationAuthenticator.java#L193

Added line #L193 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@

package org.wso2.carbon.identity.application.authentication.framework;

import org.wso2.carbon.identity.base.IdentityConstants;
import org.wso2.carbon.identity.base.AuthenticatorPropertiesConstant.AuthenticationType;

/**
* Federated application authenticator.
*/
public interface FederatedApplicationAuthenticator extends ApplicationAuthenticator {

@Override
default IdentityConstants.AuthenticationType getAuthenticationType() {
default AuthenticationType getAuthenticationType() {

return IdentityConstants.AuthenticationType.IDENTIFICATION;
return AuthenticationType.IDENTIFICATION;

Check warning on line 31 in components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/FederatedApplicationAuthenticator.java

View check run for this annotation

Codecov / codecov/patch

components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/FederatedApplicationAuthenticator.java#L31

Added line #L31 was not covered by tests
}

}
Loading

0 comments on commit 32e7a86

Please sign in to comment.