Re: Re: Basic Authentication Documentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, so this is what I found:

The only time you can set credentials is in the constructor:
$proxy = array('user'=>'myUser','pass'=>'myPass');
$client = new SOAP_Client('http://myService', false, false, $proxy);

Otherwise, you have to do this:

$client->_soap_transport = new
SOAP_Transport_HTTP('http://URL_OF_SERVICE');
$client->_soap_transport->setCredentials('myUser','myPass');

It would be also nice if there was a setTransport wrapper method in
SOAP_Client as well as a corresponding implementation in SOAP_Transport.

On the server side, it looks like you just need to validate it like any
other BASIC authorization.  This can be done at the head of the script
or inside each of your server methods:

	if (!isset($_SERVER['PHP_AUTH_USER'])) {
			header('WWW-Authenticate: Basic realm="My Realm"');
			header('HTTP/1.0 401 Unauthorized');
			echo 'Text to send if user hits Cancel button';
			exit;
		} else {
			if ( ($_SERVER['PHP_AUTH_USER'] == 'myUser') &&
($_SERVER['PHP_AUTH_PW'] == 'myPass')) {
				
				return 'validated';
			}
			else {
				header('WWW-Authenticate: Basic realm="My Realm"');
				header('HTTP/1.0 401 Unauthorized');
				return;
			}
		}


Al

On Thu, 2004-03-25 at 23:51 -0500, Al Baker wrote:
> I've already seen that.  It's basically another example from Shane's
> slides on talks.php.net.  
> 
> It's also not HTTP Basic authentication, it's a SOAP header
> authentication mechanism.  
> 
> Al
> 
> On Fri, 2004-03-26 at 10:10 +0800, Johnny wrote:
> 
> > Download the documentation from http://www.oikoyama.net/downloads/docs/.
> > After unzipping the documentation, look at the headers.html. There is an
> > example on how to authenticate.
> > 
> > "Al Baker" <ajb732@comcast.net> wrote in message
> > 1080256587.1317.2.camel@tuxtop">news:1080256587.1317.2.camel@tuxtop...
> > > Hi,
> > >
> > > Is there documentation on how to implement documentation, both client
> > > side and server side using PEAR SOAP?
> > >
> > > I the credentials in the HTTP Transport class, but nothing else and none
> > > of the examples show authenticating a client.
> > >
> > > Thanks,
> > > Al
> > 

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux