Class: DeviseOtt::Strategies::OttAuthentication

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#granted_to_emailObject (readonly)

Returns the value of attribute granted_to_email.



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

def granted_to_email
  @granted_to_email
end

Instance Method Details

#authenticate!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/devise_ott/strategies/ott_authetication.rb', line 6

def valid?
  super || valid_for_ott_auth?
end