0

I have a wcf data service which authenticates the user with custom basic authentication. I used the tutorial on MSDN Blogs OData and Authentication – Part 6 – Custom Basic Authentication. So after authenticating the user against a database, the service sets

var principal = new GenericPrincipal( new GenericIdentity("user") );
HttpContext.Current.User = principal;

Within my service I can access the principals auth status via

HttpContext.Current.Request.IsAuthenticated

Is there also a chance to get the IsAuthenticated status on my WPF client?

csteinmueller
  • 2,427
  • 1
  • 21
  • 32

1 Answers1

1

Basic authentication is performed for every request. Your client doesn't keep any state related to authentication (except pre-authentication which skips 401 handshake). If your service requires authentication you know that you are authenticated if your call to WCF-Data Service succeeds. If you are not authenticated you will receive exception.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • Thank you for your short but clear answer. Can you give me some keywords what to search for permanent authentication (Tokens?) against a wcf (data service)? – csteinmueller Apr 18 '13 at 13:14
  • That is usually called security session or security context but I don't think WCF Data Service has any support for that. – Ladislav Mrnka Apr 18 '13 at 13:25