CoreContentOnly

DefaultAuth and Accessing Content Server in Java

Sep 09, 2008

It is early in the project and you create a nifty Java application to access content server. It executes a few services and generally accomplishes some black wizardry that people OH and AH over. Everything is going well. You are just about to board the corporate jet for that all expense paid developer retreat in Hawaii when they call you back with a problem.

Customer xyz decided they wanted to use the active directory integration everywhere in the content server and now Nifty App does not work. WHAT COULD IT BE? After some truly Sherlock-like investigation work you find out they have switched the Default Authentication mechanism from Basic to NTLM. You quickly dial, "HOLD the plane, I can fix this and still make it!"

Within a minute you have your code open and spot the problem, yes, yes, of course, you will need to set a request property. Your fingers fly across the keys pouring out something akin to these pearls of wisdom:

URL url = new URL(URL);
HttpURLConnection urlConn = (HttpURLConnection)url.openConnection();
urlConn.setRequestProperty ("Cookie", "IntradocAuth=basic"); 

You casually remark on the way out the door to your stunned co-worker that this enhancement will allow your code to continue connecting with Idc Security, thereby working just fine.

Reality: While the context of this story may be a bit far-fetched the code is not.

© 2019 Jason Stortz