views:

92

answers:

4

Lets say we have a website that uses a web service for all of its functionality (i.e. retrieving and updating data from/to db), how does the web service authenticate requests?

As I understand it, in a traditional java "website" a user provides a username & password, and upon validation a jsessionid is assigned to the user (client browser). Every time the client browser asks the website for something, the site checks for the jsessionid ensuring that the user is registered and authenticated. Is there a web services equivalent of this? If yes, what?

+1  A: 

Usually for web services the most easy solution is using Basic Authentication. For something more complex, "Api Key\Token" are passed with each request to authorize\authenticate the users. Another solution is OAuth.

Twitter for example use Basic Authentication and OAuth.

Andrea
A: 

The web service world is governed by the ws-* standards.

See WS-Security:

The wikipedia article gives a nice high-level overview, oasis is the official home of the standards, and provides the detailed specifications.

crowne
A: 

Does your web service even need to be publically accessible?

You might not need to worry about complicated authentication schemes if there is no reason to allow public traffic from even reaching the web service.

matt b
While not exactly "publicly" available there are a couple of situations that may be security issues. For example, lets say the web site uses javascript (i.e. dwr) or flex apps to communicate directly with the web service, rather than through the website. While the service is not "publicly" available a decent user can figure out from the javascript or flex at the very least the web service's address and try to mis-use that information. This is the issue I'm curious about.
King
Since JavaScript and Flex are apps run on the client, then this would mean that your web service *is* publically available.
matt b
A: 

This link should give you a good introduction. Look through chapters 4 through 6. HTH.

CoolBeans