<div>I have been working on an Authentication class for a project and was wanting to provide different authentication mechanisms. Basically, I want someone to be able to change their authentication scheme either on the fly or on a per-user basis and was wondering how the best way to go about this may be.
</div>
<div> </div>
<div>What I've got so far is a generic Authenticator class that takes one argument in the constructor of the type of authentication. My plan was to have it determine and automatically load the correct class for the authentication type. So I was going to have it return an object type of the new authentication object type (
i.e. LDAP, DB, or others), when I remembered something about not being able to return anything back from the constructor of an object in this language.</div>
<div> </div>
<div>Have others tackled this task before and what means did you use. I want my code to only include the generic authenticator class, but want a more specific object type returned.</div>