class DeviseOtt::Strategies::OttAuthentication

Attributes

granted_to_email[R]

Public Instance Methods

authenticate!() click to toggle source
# File lib/devise_ott/strategies/ott_authetication.rb, line 10
def authenticate!
  ott_token = params[:ott_token]

  return unless valid_for_ott_auth?

                          @granted_to_email = DeviseOtt::Tokens.instance.granted_to_email(ott_token)
                          resource = mapping.to.find_for_ott_authentication(ott_token)

  return unless resource

  if validate(resource){ resource.ott_allowed?(ott_token, resource.email) }
    success!(resource)
  end
end
valid?() click to toggle source
Calls superclass method
# File lib/devise_ott/strategies/ott_authetication.rb, line 6
def valid?
  super || valid_for_ott_auth?
end

Private Instance Methods

remember_me?() click to toggle source

Do not use remember_me behavior with ott token.

# File lib/devise_ott/strategies/ott_authetication.rb, line 32
def remember_me?
  false
end
valid_for_ott_auth?() click to toggle source

Check if this is strategy is valid for ott authentication by:

* If the ott token exists;
* If ott module is included
# File lib/devise_ott/strategies/ott_authetication.rb, line 41
def valid_for_ott_auth?
  params[:ott_token].present? && mapping.to.respond_to?(:find_for_ott_authentication)
end
valid_params_request?() click to toggle source

Ott Authenticatable can be authenticated with params in any controller and any verb.

# File lib/devise_ott/strategies/ott_authetication.rb, line 27
def valid_params_request?
  true
end