Class: DeviseOtt::Strategies::OttAuthentication

Inherits:
Devise::Strategies::Authenticatable
  • Object
show all
Defined in:
lib/devise_ott/strategies/ott_authetication.rb

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/devise_ott/strategies/ott_authetication.rb', line 8

def authenticate!
  ott_token = params[:ott_token]

  return fail! unless mapping.to.respond_to?(:find_for_ott_authentication) # Dont try to authenticate if module is not included

  resource = mapping.to.find_for_ott_authentication(ott_token)

  return fail! unless resource

  if validate(resource){ resource.ott_allowed?(ott_token, resource.email) }
    success!(resource)
  end
end

#valid?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/devise_ott/strategies/ott_authetication.rb', line 4

def valid?
  super || valid_for_ott_auth?
end