diff --git a/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/UserDefinedAuthenticatorEndpointConfig.java b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/UserDefinedAuthenticatorEndpointConfig.java index 444d6e41bb0e..acf08bc83cb1 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/UserDefinedAuthenticatorEndpointConfig.java +++ b/components/application-mgt/org.wso2.carbon.identity.application.common/src/main/java/org/wso2/carbon/identity/application/common/model/UserDefinedAuthenticatorEndpointConfig.java @@ -18,9 +18,11 @@ package org.wso2.carbon.identity.application.common.model; +import org.wso2.carbon.identity.action.management.model.AuthProperty; import org.wso2.carbon.identity.action.management.model.Authentication; import org.wso2.carbon.identity.action.management.model.EndpointConfig; +import java.util.HashMap; import java.util.Map; /** @@ -40,6 +42,40 @@ public EndpointConfig getEndpointConfig() { return endpointConfig; } + /** + * Get the URI of the authenticator endpoint of the user defined authenticator. + * + * @return URI of the authenticator endpoint. + */ + public String getAuthenticatorEndpointUri() { + + return endpointConfig.getUri(); + } + + /** + * Get the authentication type of the authenticator endpoint of the user defined authenticator. + * + * @return Authentication type of the authenticator endpoint. + */ + public String getAuthenticatorEndpointAuthenticationType() { + + return endpointConfig.getAuthentication().getType().getName(); + } + + /** + * Get the authentication properties of the authenticator endpoint of the user defined authenticator. + * + * @return Authentication properties of the authenticator endpoint. + */ + public Map getAuthenticatorEndpointAuthenticationProperties() { + + Map propertyMap = new HashMap<>(); + for (AuthProperty prop: endpointConfig.getAuthentication().getProperties()) { + propertyMap.put(prop.getName(), prop.getValue()); + } + return propertyMap; + } + /** * UserDefinedAuthenticatorEndpointConfig builder. */ diff --git a/components/application-mgt/org.wso2.carbon.identity.application.common/src/test/java/org/wso2/carbon/identity/application/common/model/test/UserDefinedAuthenticatorTest.java b/components/application-mgt/org.wso2.carbon.identity.application.common/src/test/java/org/wso2/carbon/identity/application/common/model/test/UserDefinedAuthenticatorTest.java index f4dc6f8f2eee..61c115d3dc94 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.common/src/test/java/org/wso2/carbon/identity/application/common/model/test/UserDefinedAuthenticatorTest.java +++ b/components/application-mgt/org.wso2.carbon.identity.application.common/src/test/java/org/wso2/carbon/identity/application/common/model/test/UserDefinedAuthenticatorTest.java @@ -85,11 +85,9 @@ public void createEndpointConfigurationTest(String uri, String authenticationTyp endpointConfigBuilder.authenticationProperties(endpointConfig); UserDefinedAuthenticatorEndpointConfig authEndpointConfig = endpointConfigBuilder.build(); - assertEquals(authEndpointConfig.getEndpointConfig().getUri(), uri); - assertEquals(authEndpointConfig.getEndpointConfig().getAuthentication().getType().getName(), - authenticationType); - assertEquals(authEndpointConfig.getEndpointConfig().getAuthentication().getProperties().size(), - endpointConfig.size()); + assertEquals(authEndpointConfig.getAuthenticatorEndpointUri(), uri); + assertEquals(authEndpointConfig.getAuthenticatorEndpointAuthenticationType(), authenticationType); + assertEquals(authEndpointConfig.getAuthenticatorEndpointAuthenticationProperties(), endpointConfig); } @DataProvider(name = "invalidEndpointConfig")