简体   繁体   中英

Accessing WCF Service with windows authentication from another domain using jquery

I have a WCF Service with windows authentication in domain A.

I have a ASP page with jQuery in domain B.

I would like to access the WCF service with Windows Authentication in domain A from domain B.

If domain A has Anonymous Authentication, then the request from domain B works.

If not, I get a "Access is denied" error.

I see two approaches here:

  1. Use webHttpBinding and implement a IDispatchMessageInspector
  2. Use JSONP with a callback

Which approach is better?

I already have a basicHttpBinding which is used by other ASP.NET web applications.

Can I extend the basicHttpBinding to support jquery calls?

So you want a workaround/hack to walk around/circumvent Windows security? If so, that's fine. And you have 2 solutions.

  1. Setup a gateway service translate requests outside domain A into requests from domain A. If you have biztalk, things will be even easier.

  2. Provide a new endpoint with a binding (http or json) not rely on Windows domain security, say username/password and certificate etc. This can be done through configuration alone. So basically clients in domain A may keep using endpoint 1 with Windows security, while clients on the other domains and the Internet will be using endpoint 2 and 3 .

So far I don't see any reason from your post why you need callback.

After all, you should also consult with your system administrators about the details settings

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM