Implement three types of authentication (basic, facebook and twitter)
===

I am working on an Iphone application. I implemented a basic authentication with username and password.

However I need to add two other choices:

 - Login with Facebook
 - Login with Twitter

I know how to do the Facebook and the Twitter authentication. However my question is: How to make all three available? How do I architect my code for that.

What I mean is that before certain actions or request, I need to check if the user is still authenticated, I now just use a method in the basic authentication manager. but each type of authentication have a different way to check that. So I need to detect which authentication has been used first and then use it's appropriate validation.

So how can I know which one has been used? and to make sure that he is authenticated with one of the method.

Thanks for any tips or help