diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java index d8e779d658d..1c320410b66 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java @@ -84,7 +84,7 @@ public class AuthenticationHandler implements Handler { String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"); + .getHttpsPort() + CoreUtils.getIosVerifyEndpoint()); Map certVerifyHeaders = new HashMap<>(); certVerifyHeaders.put("Authorization", "Bearer " + accessToken); certVerifyHeaders.put("Content-Type", "application/json"); @@ -103,7 +103,7 @@ public class AuthenticationHandler implements Handler { CoreUtils.debugLog(log, "Verify subject DN: ", subjectDN); String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/android"); + .getHttpsPort() + CoreUtils.getAndroidVerifyEndpoint()); Map certVerifyHeaders = new HashMap<>(); certVerifyHeaders.put("Authorization", "Bearer " + accessToken); certVerifyHeaders.put("Content-Type", "application/json"); @@ -123,7 +123,7 @@ public class AuthenticationHandler implements Handler { String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"); + .getHttpsPort() + CoreUtils.getAndroidVerifyEndpoint()); Map certVerifyHeaders = new HashMap<>(); certVerifyHeaders.put("Authorization", "Bearer " + accessToken); certVerifyHeaders.put("Content-Type", "application/json"); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java index 12bcda249a5..03a8780efc9 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java @@ -28,6 +28,8 @@ public class AuthConstants { public static final String HTTPS_PORT = "httpsPort"; public static final String USERNAME = "username"; public static final String PASSWORD = "password"; + public static final String IOS_VERIFY_ENDPOINT = "ios-verify-endpoint"; + public static final String ANDROID_VERIFY_ENDPOINT = "android-verify-endpoint"; public static final String MDM_SIGNATURE = "mdm-signature"; public static final String PROXY_MUTUAL_AUTH_HEADER = "proxy-mutual-auth-header"; public static final String ENCODED_PEM = "encoded-pem"; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java index 42a7fe9ea75..852e2529b7f 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java @@ -37,6 +37,8 @@ public class CoreUtils { private static int httpsPort = 9443; private static String username = "admin"; private static String password = "admin"; + private static String iosVerifyEndpoint = "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"; + private static String androidVerifyEndpoint = "/api/certificate-mgt/v1.0/admin/certificates/verify/android"; /** * Reading configurations from api-filter-config.xml file @@ -88,6 +90,12 @@ public class CoreUtils { } else if (AuthConstants.PASSWORD.equals(beanName)) { String value = beanProp.getAttributeValue(new QName(null, "value")); password = value; + } else if (AuthConstants.IOS_VERIFY_ENDPOINT.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + iosVerifyEndpoint = value; + } else if (AuthConstants.ANDROID_VERIFY_ENDPOINT.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + androidVerifyEndpoint = value; } } } @@ -137,4 +145,12 @@ public class CoreUtils { public static String getPassword() { return password; } + + public static String getIosVerifyEndpoint() { + return iosVerifyEndpoint; + } + + public static String getAndroidVerifyEndpoint() { + return androidVerifyEndpoint; + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml index 8811ccb8e78..fc6c2417599 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml @@ -18,5 +18,7 @@ + + \ No newline at end of file