Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic auth fails when sending GET request through corporate NTLM proxy #1227

Open
datovarc opened this issue Nov 14, 2019 · 1 comment
Open

Comments

@datovarc
Copy link

datovarc commented Nov 14, 2019

Hi,

Currently while working under a corporate proxy (NTLM), a GET request I send to an API Endpoint keeps failing, and I can see 'WWE-Authenticate: Basic realm="Realm" ' in the response. Which makes me believe, the request is not using the basic auth I set in the request.

When I run exactly the same request, without the corporate proxy, I can get the expected response from the API.

Also, even through Postman or web browser, I can get the response expected while using the corporate proxy.

Currently this is the code used for setting up the proxy. Please note that in this test, we try to hit multiple endpoints of the same API, all of them are successful, except the one that requires Basic Auth. So, proxy does work.

ProxySpecification proxySpec = new ProxySpecification(proxyHost, proxyPort, proxyScheme).withAuth(username, password); RestAssured.proxy(proxySpec)

The Request sent is created like:
//First Attempt
//Have also tried passing the Proxy-Authorization in the header, also failed
String auth = new String(Base64.encodeBase64(new String(authUser+":"+authPassword).getBytes())); auth = "Basic " + auth;

getRequest = apiUtils.getTokenRequest().headers("Accept", "application/vnd.app-" + VERSION_NAME + "+json","AppVersion", VERSION_NAME,"SESSIONID", sessionId,"CSRFToken", getCSRFToken(), "Authorization", auth).queryParam("param1",param1);

//Second Attempt
getRequest = apiUtils.getTokenRequest().auth().basic(authUser, authPassword).headers("Accept", "application/vnd.app-" + VERSION_NAME + "+json","AppVersion", VERSION_NAME,"SESSIONID", sessionId,"CSRFToken", getCSRFToken()).queryParam("param1",param1);

//Third Attempt
RestAssured.authentication = basic(authUser, authPassword);

getRequest = apiUtils.getTokenRequest().headers("Accept", "application/vnd.app-" + VERSION_NAME + "+json","AppVersion", VERSION_NAME,"SESSIONID", sessionId,"CSRFToken", getCSRFToken()).queryParam("param1",param1);

Please find attached the Postman response:
postman_reply

And the RestAssured response:
image

Any help would be greatly appreciated! If there is any other information needed, please don't hesitate to ask.

Thanks and Best Regards,
David Alejandro

@kubilaykarpat
Copy link

Hi @datovarc were you able to make any progress on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants