views:

35

answers:

1

Hi guys,

I'm having some wonders. How's session based authentication designed for webservices ? Imagine I do have a web solution where people can sign up and then log themselves in, then they can do stuff that's processed by webservices (either hosted on the same machine or on a remote server).

I know how to manage sessions after log in on a regular web page, but how is my (remote or local) web service going to know that the user who's triggering it is logged in (in other words, is there a way to pass the session object to a web service in a secure way?)

I can think of simply calling the web service by giving it the session object but It looks kinda weak.

Thanks for your advises guys,

Miloud B.

+1  A: 

Hi Miloud B.

Web services use http as the underlying protocol, so session state would be handled in a similar way to asp.net. So a cookie would be created containing the session id and this would be passed to and from the web service.

If i have misunderstood let me know a little more info. Cheers Tigger

Tigger
I don't know if we're talking about the same thing actually, I don't get it with cookies as I know that cookies are a way used by servers to store data in the client's browser. What I'm saying is that currently what I'd do to check within my WS if the user is logged in is something like: myyWebservice.doSomething(userSession, other_arg,...) then in doSomething i check whether userSession indicates a logged in client if so I perform the action, otherwise I say access denied. Do you get my point ?
Miloud B.
Perhaps we arent talking about the same thing, so to cover all bases; a link for securing your web service http://dotnetslackers.com/articles/aspnet/Securing-ASP-Net-Web-Services-with-Forms-Authentication.aspx and in case your not sure about setting up session state with a web service here is another article http://www.codeproject.com/articles/35119/Using-Session-State-in-a-Web-Service.aspx
Tigger
Thank you very much I was getting hard times finding these articles since google put me through articles about windows based auth. against WS and such stuff.
Miloud B.