This is a snippet of a credential checker I wrote to authenticate a user first via my DB, and if that fails via Twitter. It helped me to speed up login, after the initial Twitter access tokens are stored.

In theory, this snippet could be used to authenticate against any number of checkers, providing different interfaces. Only if all of them fail, it returns an error.