[SabreAMF] Easy way to setCredentials
Dan Rossi
spam at electroteque.org
Sun Feb 25 07:12:10 EST 2007
Hi there i have modified the Flex_DataServicesServer.php class to add a
handler for authentication so i can do setCredentials, however its ok
when the credentials are right, but when they are incorrect and i get
the wrong error return like "Channel.Ping.Failed error"
$this->server->onAuthenticate = array($this,'authenticate');
the gateway script calls this in the service class
public function setCredentials($username , $password)
{
$this->_username = $username;
$this->_password = $password;
}
my authenticate method looks like this
public function authenticate($username, $password)
{
if ($this->_username && $this->_password)
{
if ((strcmp($this->_username, $username) == 0) &&
(strcmp($this->_password, $password) == 0))
{
return true;
}
throw new SabreAMF_AuthenticationException($username,
$password);
}
return true;
}
the authentication exception looks like this
class SabreAMF_AuthenticationException extends Exception implements
SabreAMF_DetailException {
/**
* Constructor
*/
public function __construct( $username, $password ) {
// Specific message to ClassException
$this->message = "Authentication failed using " . $username
. " ". $password ;
$this->code = "Server.Processing";
// Call parent class constructor
parent::__construct( $this->message );
}
public function getDetail() {
return "Please set the correct credentials.";
}
}
Any ideas ?
Is there anyway to set the roles and credntials in the
service-config.xml like with WebORB ? This doesnt seem to work.
<destination id="SaveImage">
<properties>
<source>org.electroteque.imaging.ImagingService</source>
</properties>
<security>
<security-constraint>
<auth-method>Custom</auth-method>
<roles>
<role>administrator</role>
</roles>
</security-constraint>
</security>
</destination>
I cant specify a source either to a destination like
<destination id="ComplexTypesTest">
<properties>
<source>weborb.tests.ComplexTypesTest</source>
</properties>
</destination>
Let me know thanks.
More information about the sabreamf
mailing list