module Authifer::OAuthHelper

Public Instance Methods

handle_oauth() click to toggle source
# File lib/authifer/oauth_helper.rb, line 11
def handle_oauth
  if oauth2.redirect?
    redirect oauth2.redirect_uri, oauth2.response_status
  end

  headers oauth2.response_headers
  status  oauth2.response_status

  if body = oauth2.response_body
    body
  elsif oauth2.valid?
    erb :authorize, locals: { authorization_request: oauth2 }
  else
    raise "Error Will Robinson"
  end
end
oauth2() click to toggle source
# File lib/authifer/oauth_helper.rb, line 7
def oauth2
  @oauth2 ||= Songkick::OAuth2::Provider.parse(resource_owner, env)
end
resource_owner() click to toggle source
# File lib/authifer/oauth_helper.rb, line 3
def resource_owner
  @resource_owner ||= current_user.persisted? ? current_user : :implicit
end