From 439ce4f1ece64dcf6b6ef190fa0639a8e6aa95a8 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Thu, 15 Aug 2019 22:23:46 +0200 Subject: [PATCH] Fix apim handler test failures --- .../wso2/carbon/apimgt/handlers/AuthenticationHandler.java | 2 +- .../carbon/apimgt/handlers/AuthenticationHandlerTest.java | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) 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 5638f3ba58..06d344a514 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 @@ -55,7 +55,7 @@ public class AuthenticationHandler extends AbstractHandler { private static final String X_JWT_ASSERTION = "X-JWT-Assertion"; private static final String JWTTOKEN = "JWTToken"; private static final String AUTHORIZATION = "Authorization"; - private static final String BEARER = "Bearer "; + private static final String BEARER = "Basic "; private static final String CONTENT_TYPE = "Content-Type"; private IOTServerConfiguration iotServerConfiguration; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/test/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandlerTest.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/test/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandlerTest.java index b3b8cdac78..23e6b251fc 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/test/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandlerTest.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/test/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandlerTest.java @@ -92,8 +92,6 @@ public class AuthenticationHandlerTest extends BaseAPIHandlerTest { HashMap transportHeaders = new HashMap<>(); transportHeaders.put(AuthConstants.MDM_SIGNATURE, "some cert"); setMockClient(); - this.mockClient.setResponse(getDCRResponse()); - this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getValidationResponse()); boolean response = this.handler.handleRequest(createSynapseMessageContext("", this.synapseConfiguration, transportHeaders, "https://test.com/testservice/device-mgt/testdevice")); @@ -107,7 +105,6 @@ public class AuthenticationHandlerTest extends BaseAPIHandlerTest { HashMap transportHeaders = new HashMap<>(); transportHeaders.put(AuthConstants.PROXY_MUTUAL_AUTH_HEADER, "Test Header"); setMockClient(); - this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getValidationResponse()); boolean response = this.handler.handleRequest(createSynapseMessageContext("", this.synapseConfiguration, transportHeaders, "https://test.com/testservice/device-mgt/testdevice")); @@ -121,7 +118,6 @@ public class AuthenticationHandlerTest extends BaseAPIHandlerTest { HashMap transportHeaders = new HashMap<>(); transportHeaders.put(AuthConstants.MUTUAL_AUTH_HEADER, "Test Header"); setMockClient(); - this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getValidationResponse()); MessageContext messageContext = createSynapseMessageContext("", this.synapseConfiguration, transportHeaders, "https://test.com/testservice/device-mgt/testdevice"); @@ -141,7 +137,6 @@ public class AuthenticationHandlerTest extends BaseAPIHandlerTest { HashMap transportHeaders = new HashMap<>(); transportHeaders.put(AuthConstants.ENCODED_PEM, "encoded pem"); setMockClient(); - this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getValidationResponse()); MessageContext messageContext = createSynapseMessageContext("", this.synapseConfiguration, transportHeaders, "https://test.com/testservice/device-mgt/testdevice"); @@ -156,7 +151,6 @@ public class AuthenticationHandlerTest extends BaseAPIHandlerTest { HashMap transportHeaders = new HashMap<>(); transportHeaders.put(AuthConstants.ENCODED_PEM, "encoded pem"); setMockClient(); - this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(getInvalidResponse()); MessageContext messageContext = createSynapseMessageContext("", this.synapseConfiguration, transportHeaders, "https://test.com/testservice/device-mgt/testdevice"); @@ -185,7 +179,6 @@ public class AuthenticationHandlerTest extends BaseAPIHandlerTest { HashMap transportHeaders = new HashMap<>(); transportHeaders.put(AuthConstants.ENCODED_PEM, "encoded pem"); setMockClient(); - this.mockClient.setResponse(getAccessTokenReponse()); this.mockClient.setResponse(null); MessageContext messageContext = createSynapseMessageContext("", this.synapseConfiguration, transportHeaders, "https://test.com/testservice/device-mgt/testdevice");