21

We have SOAP web services in production that are relying on SOAP Headers (containing plain client credentials) for the authentication. The WS are used in heterogeneous environments with .NET/Java/PHP/Python/C++ clients both web app or desktop app.

We are considering a v2 for those WS and I am wondering what are considered as the best practices for WS SOAP authentication? (reasonably secure, yet easy to handle on a wide variety of platforms).

Joannes Vermorel
  • 8,976
  • 12
  • 64
  • 104

3 Answers3

15

The easiest way to handle it across a variety of platforms is to use HTTP basic authentication and HTTPS for the transport layer. WS-Security would be good if your needs go beyond simple username/password but the support is going to vary quite a bit between platforms. HTTP authentication is supported by every decent SOAP implementation.

Dave Dunkin
  • 1,037
  • 8
  • 13
4

If you have to roll it all yourself and can't use HTTPS, I'd suggest the hash-based UsernameToken portion of WS-Security. It's pretty secure and fairly easy to implement as long as your libraries have the hashing functions.

If you're doing web services, I wouldn't rely on HTTP for authentication.

WS-Security as a whole is way too big.

David Norman
  • 19,396
  • 12
  • 64
  • 54
  • 1
    Why not rely on existing HTTP authentication, is this only if you CAN'T use https? – Jé Queue Mar 01 '11 at 19:20
  • @Xepoch are talking about basic auth where user name and pwd sent as soap header ? – Mou Nov 22 '16 at 12:30
  • @David please tell me how to implement "hash-based UsernameToken portion of WS-Security.". can u give me any link from where i can read code and download code to run in my pc. thanks – Mou Nov 22 '16 at 12:37
2

The way I have tackled this in the past is to use the standard WS-* features.

Instead of using the authentication feature we set the message header integrity feature on. This requires both sides of the dialog have access to public/private key pair and detects any tampering of the username field in the header. So you can be sure whoever sent the message and set the user id has access to the private key.

This provides a reasonable level of integrity if the keys are managed properly.

James Anderson
  • 27,109
  • 7
  • 50
  • 78