Solved

NTLM in ajax calls

Posted on 2014-04-23
8
1,842 Views
Last Modified: 2014-05-03
Hi Experts,

I just noticed that the browser doesn't take over the 401 responses that we get in ajax when NTLM is expected with the server.  To be more precise - it looks like I need to implement NTLM in ajax myself?  Is there an easy way to do this?

Thanks!
Mike
0
Comment
Question by:thready
  • 5
  • 3
8 Comments
 
LVL 37

Expert Comment

by:Bing CISM / CISSP
ID: 40019369
Ajax is not a single technology, but a group
of technologies of HTML, CSS, DCOM and JavaScript to dynamically display for and interact with users. sepcifically, JavaScript and the XMLHttpRequest object provide a method for exchanging data asynchronously between browser and server to avoid full page reloads.

therefore, basically NTLM has nothing to do Ajax itself, it may be related to HTTP request if NTLM authentication is required.

if the web server is IIS, you may enable Integrated Windows Authentication to allow NTLM authentication over HTTP. from Ajax programming side, nothing you can do specifically for NTLM authentication.

however, be aware although you won't be exposing credentials in cleartext using NTLM over HTTP, you will be exposing everything else, so the afterward HTTP traffic won't be secure from confidentiality or integrity breaches.
0
 
LVL 1

Author Comment

by:thready
ID: 40020373
Well, I've implemented NTLM in an http server.  It works fully when you navigate to a site it serves up when you enter the site on the browser address field.  But when you make similar requests through xhr (which also happen to be cross domain), they don't authenticate.

I'm going to see if non-cross domain calls will authenticate first to see if it's something to do with the CORS headers.
0
 
LVL 1

Author Comment

by:thready
ID: 40020376
By the way, the CORS code worked fine before I added the NTLM functionality to the server...
0
 
LVL 37

Expert Comment

by:Bing CISM / CISSP
ID: 40020436
> Well, I've implemented NTLM in an http server.

on an IIS website over HTTP? is the IIS a member of domain?

> when you make similar requests through xhr (which also happen to be cross domain), they don't authenticate.

in my understanding, for NTLM authentication, basically it depends on the NTFS permissions of the pages/files to allow or deny the users' HTTP requests. therefore, for requests across domain, they will be denied as the files on NTFS not permitted to be accessed.
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 1

Author Comment

by:thready
ID: 40020486
But it's not IIS - it's our own web server code from an open source project (C# webserver)...  Which does work for normal browser address bar style requests...
0
 
LVL 37

Expert Comment

by:Bing CISM / CISSP
ID: 40020524
> Well, I've implemented NTLM in an http server.
>> But it's not IIS - it's our own web server code ...

your "implemented" does mean "implemented", i thought it just meant "deployed". :-))

where are the web pages physically located? still on a NTFS partition of Windows?
0
 
LVL 1

Accepted Solution

by:
thready earned 0 total points
ID: 40026039
I figured it out- the server side code did handle normal address bar requests because the browser implements that.  However, it seems the browser does go through entirely different code when calls come from ajax - particularly calls from ajax that are cross domain.  The solution was to add the correct server side headers for CORS and in addition, use the extra parameter in ajax stating, "use-credentials" if I remember correctly.  Very tricky actually - at the very least - 3 separate variables preventing all this from working in the normal way...

Thanks for trying - there was a lot more involved than I described in my question- the cost of trying to pinpoint problems...
0
 
LVL 1

Author Closing Comment

by:thready
ID: 40039039
It's the solution!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now