2009-10-18 09:15:23 -04:00
|
|
|
module Devise
|
|
|
|
module Strategies
|
2009-11-14 23:13:54 -05:00
|
|
|
# Base strategy for Devise. Responsible for verifying correct scope and mapping.
|
2010-01-14 09:47:14 -05:00
|
|
|
class Base < ::Warden::Strategies::Base
|
2010-03-31 15:43:19 -04:00
|
|
|
# Checks if a valid scope was given for devise and find mapping based on this scope.
|
2009-10-18 09:15:23 -04:00
|
|
|
def mapping
|
2010-02-06 04:06:22 -05:00
|
|
|
@mapping ||= begin
|
|
|
|
mapping = Devise.mappings[scope]
|
|
|
|
raise "Could not find mapping for #{scope}" unless mapping
|
|
|
|
mapping
|
|
|
|
end
|
2009-10-18 09:15:23 -04:00
|
|
|
end
|
2010-03-29 10:13:19 -04:00
|
|
|
|
2010-03-31 15:43:19 -04:00
|
|
|
def succeeded?
|
|
|
|
@result == :success
|
2010-03-29 10:13:19 -04:00
|
|
|
end
|
2009-10-18 09:15:23 -04:00
|
|
|
end
|
|
|
|
end
|
2010-03-31 15:43:19 -04:00
|
|
|
end
|