Class: OmniAuth::Strategies::Whichsignupapi

Inherits:
Object
  • Object
show all
Includes:
OmniAuth::Strategy, Whichsignupapi::AuthHashDelegator
Defined in:
lib/omniauth/strategies/whichsignupapi.rb

Instance Method Summary collapse

Methods included from Whichsignupapi::AuthHashDelegator

#delegate_to, #extra, #info, #uid

Instance Method Details

#authenticate(login, password, always_get_details = false) ⇒ Object



35
36
37
38
39
# File 'lib/omniauth/strategies/whichsignupapi.rb', line 35

def authenticate(, password, always_get_details = false)
  result = OmniAuth::Whichsignupapi::ApiMethods.(options['api_url'], options['api_secret'], options['token_secret'], , password || '', always_get_details)
  fail!(:invalid_credentials) unless result[:authenticated] || always_get_details
  OmniAuth::Whichsignupapi::AuthHashDelegate.new(options['name'], result)
end

#callback_phaseObject



25
26
27
28
29
# File 'lib/omniauth/strategies/whichsignupapi.rb', line 25

def callback_phase
  results = authenticate(request['login'], request['password'])
  delegate_to(results)
  super
end

#handles(login) ⇒ Object



31
32
33
# File 'lib/omniauth/strategies/whichsignupapi.rb', line 31

def handles()
  OmniAuth::Whichsignupapi::ApiMethods.handles(options['api_url'], options['api_secret'], options['token_secret'], )
end

#request_phaseObject



17
18
19
20
21
22
23
# File 'lib/omniauth/strategies/whichsignupapi.rb', line 17

def request_phase
  form = OmniAuth::Form.new(:title => "Which? Login", :url => callback_path)
  form.text_field "Email or Which? username", 'login'
  form.text_field "Password", 'password'
  form.button "Sign In"
  form.to_response
end