September 24th, 2008Http Authentication for SOAP Messages in PHP - 2 Minutes Introduction
Yesterday’s blog on “Using Username token in Authentication” I explained a standard way of authenting SOAP messages in Application layer (Message level Authentication). Anyway you can authenticate SOAP messages in transport level itself. For an example with HTTP Transport we can use the HTTP Basic Authentication for this purpose.
Setting up a client with Authentication Information
With WSF/PHP you can give the username, password and the authentication type as options for WSClient constructor.
$client = new WSClient(array ("to" => "http://server/myendpoint", "httpAuthUsername" => "user", "httpAuthPassword" => "user_password", "httpAuthType" => "basic"));
Setting up the Server to Handle the Authentication
Since the Http authentication is handled by the transport level, you have to configure your authentication information in your web server itself. (e.g. Apache or IIS).
If you are using Apache, please use this guide to configure your allowed list to access the server.
![[Ask]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/ask.png)
![[Bloglines]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/bloglines.png)
![[del.icio.us]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/digg.png)
![[diigo]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/diigo.png)
![[dzone]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/dzone.png)
![[Facebook]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/facebook.png)
![[Google]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/google.png)
![[MySpace]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/myspace.png)
![[MyWeb]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/myweb.png)
![[Newsvine]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/newsvine.png)
![[PlugIM]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/plugim.png)
![[Reddit]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/slashdot.png)
![[Spurl]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/spurl.png)
![[StumbleUpon]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Twitter]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/twitter.png)
![[Windows Live]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.dimuthu.org/wp-content/plugins/bookmarkify/email.png)