locked
Forms Authentication and Data Services RRS feed

  • Question

  • I am using ado.net dataservices. I would like to lock them down with forms authentication so my client web apps (which may be on different machines) can call them. Ideally I would like to specify a username/password and gain access to the services in my application. Is there a way of doing this. I was under the impression data services are built on top of WCF how does one do this with WCF. I am quite new to this so no answer is too basic Smile

    Monday, December 1, 2008 10:36 PM

Answers

  • Astoria does not know anything about forms security per se, because that already happens before your service gets called.  Inside your interceptors or service operations you can inspect what user (etc) the web server authenticated (or not) so then you can make other moves. If the user does not get authenticated passed web server, astoria does not get called.  Such as:

     

    string userName = HttpContext.Current.User.Identity.Name;

    Console.WriteLine(userName);

    if (HttpContext.Current.User.IsInRole("Admins") return;

    ...

    Thursday, December 4, 2008 8:53 AM

All replies

  • Wednesday, December 3, 2008 10:27 PM
    Answerer
  • I have got the Forms Authentication working I can't figure figure out how to send the username and password from my application to the Data Services, which I am trying to lock down with Forms Authentication.

    Wednesday, December 3, 2008 10:39 PM
  • Astoria does not know anything about forms security per se, because that already happens before your service gets called.  Inside your interceptors or service operations you can inspect what user (etc) the web server authenticated (or not) so then you can make other moves. If the user does not get authenticated passed web server, astoria does not get called.  Such as:

     

    string userName = HttpContext.Current.User.Identity.Name;

    Console.WriteLine(userName);

    if (HttpContext.Current.User.IsInRole("Admins") return;

    ...

    Thursday, December 4, 2008 8:53 AM