Hi Danushka, The only change you need to make in your SaslServer is to manipulate the incoming plain text in validatePassword() (eg using a static function that presumably already exists in your custom PD class) in such way that you can compare it with the PasswordCallback result, without needing to create a new type of PasswordCallback or modify the CallbackHandlers or anything else. Then simply subclass the PlainInitialiser and PlainSaslServerFactory to create and register your new PlainSaslServer(Factory) subclasses, and use the new Initialiser when creating your new PD instead of the existing PlainInitialiser for the PlainPasswordFilePD.
Robbie On 9 July 2010 12:38, Danushka Menikkumbura <[email protected]> wrote: > Hi Robbie, > > To make that process quicker for you I have checked in a change to >> PlainSaslServer which moves the password verification into a protected >> method that you can override in a subclass and perform the necessary steps >> to authenticate against your custom data. You can also subclass and >> override >> the relevant creation/registration methods in PlainSaslServerFactory and >> PlainInitialiser to create the new SaslServer and return the new factory >> class, ultimately using the new initialiser within your custom >> PrincipalDatabase to register your new SaslServer for use. As you are going >> to be using your new PrincipalDatabase instead of one of the existing >> PrincipalDatabases, the existing PlainSaslServer thus won't be used. >> > > All this is fine but the issue here is that in order for this to work I need > to pass a reference to my PrincipalDatabase all the way up to my derived > PlainSaslServer class. The reason is I should be able to call a relevant > function in my custom database from your new "validatePassword" function. > Therefore the only possibility as far as I can see is as follows. > > 1. Clone the exising PlainSaslServer > 2. Have a new callback for authentication > 3. Use that authentication callback instead of the PasswordCallback in the > evaluateResponse method of the new PlainSaslServer > 4. Modify handle method in UsernamePasswordInitialiser to set authentication > result > 5. Use the result in authentication callback to check for authentication > instead of using validatePassword method > > Please let me know if I am missing something. > > I'll try and take a look at QPID-2720 soon. > > > Thanks, > Danushka > > -- > Danushka Menikkumbura > Apache Axis2 PMC Member > > Apache Qpid - World Domination through Advanced Message Queueing ; > http://qpid.apache.org > > phone : +94 77 364 1754 > personal blog : http://danushka-menikkumbura.blogspot.com/ > <http://danushka-menikkumbura.blogspot.com/>technical blog : > http://danushkastechythoughts.blogspot.com/ > <http://danushkastechythoughts.blogspot.com/>twitter : > http://twitter.com/danushkamenik > <http://twitter.com/danushkamenik>linkedin : > http://lk.linkedin.com/in/danushka > --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:[email protected]
