Ben Alex wrote:

Sean Radford wrote:

Hi,

Just wondering what the intended functionality of AuthenticationManager is for the authenticate method when an instance is passed an Authentication object that the manager is unable to process as it is simply the incorrect type (it does not support it). Should it be an java.lang.IllegalArgumentException or just an AuthenticationException?

(This is similar to the ProviderManager, which throws a ProviderNotFoundException)

And as a slight aside. Why does AuthenticationProvider not extend AuthenticationManager? Or just have one interface that covers both?


Regards,

Sean

Hi Sean

AuthenticationManager is expected to throw an AuthenticationException or subclass if it cannot authenticate (not IllegalArgumentException).

Whilst ProviderManager is the only concrete implementation of AuthenticationManager, and it is expected to be used in most cases, I wanted to provide flexibility in case people didn't like the way ProviderManager worked. For instance, they may not want to use a supports() method or even a provider-based approach at all.

AuthenticationProvider needs to have the supports() method, meaning we can't use the same interface as AuthenticationManager. You're probably right in that we could subclass AuthenticationManager, but the reason we don't is because of the subtle behaviour that an AuthenticationProvider can return null from its authenticate() method to indicate it does not support a given Authentication. On the other hand, AuthenticationManager should never return null from the authenticate() method.

Best regards
Ben


------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Acegisecurity-developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Thanks Bean for clearing that up. It's how I guessed things were intended, but even with reading the source, just wanted the clarification.

Regards,

Sean

--
Dr. Sean Radford, MBBS, MSc
[EMAIL PROTECTED]
http://bladesys.demon.co.uk/




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Acegisecurity-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to