[SabreAMF] Easy way to setCredentials

Evert | Rooftop evert at rooftopsolutions.nl
Mon Feb 26 11:52:51 EST 2007


Hi Dan,

Sorry for my late reply.. I had some internet struggles over the weekend..

I am assuming some error is being throw somewhere in your code.. The 
best way to debug this is to install Charles[1] and see whats going on 
over the wire..

I'm pretty much assuming there's a parse error somewhere in your code, 
because the code already fails at the ping..  If you can't figure it out 
by looking at charles, ping me again =)

Evert

[1] http://www.xk72.com/charles/


Dan Rossi wrote:
> 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.
>
>
>
>
> _______________________________________________
> sabreamf mailing list
> sabreamf at osflash.org
> http://osflash.org/mailman/listinfo/sabreamf_osflash.org
>   




More information about the sabreamf mailing list