intridea/omniauth — pull request #729 by doggydogworld (2014-03-20 09:41:49+00:00)
Title: Adds a filter function

Adds a filter function to Builder and config.
If this is set, then Strategy will call this function before it even
considers passing it on to request_call, options_call, etc.
If the return value is false, then Strategy will call the app instead of
handling the call itself.

The purpose of this patch is to allow apps to filter calls to OmniAuth.
For example, if a user is already logged in and requests /auth/:provider
(either accidentally or out of mischief), then the app may want to prevent
OmniAuth from handling it and handle the error gracefully.

There may be more efficient ways to implement this, but I just wanted
to initiate a conversation.