andypike/ruby_videos — pull request #5 by andypike (2014-12-21 23:35:20+00:00)
Title: Add authentication via GitHub

Using OmniAuth to provide the authentication with GitHub. Also added
Trailblazer. The LoginWithOmniAuth operation is given the omniauth hash
and then it will validate the hash to ensure all required data is passed
then it will either return an existing user matching the provider and
uid or it will create a new user, store the details and then return it.

In the controller we just store the id of the authenticated user. We
have a current_user helper method in ApplicationController which will
either return a User (based on the stored id) or if that is missing or
invalid then we return a GuestUser. This follows the NullObject pattern
in an attempt to reduce nils in the system. GuestUser#authenticated?
aways returns false where as User#authenticated always returns true.