1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
# frozen_string_literal: true
module Devise
module Strategies
# Base strategy for Devise. Responsible for verifying correct scope and mapping.
class Base < ::Warden::Strategies::Base
# Whenever CSRF cannot be verified, we turn off any kind of storage
def store?
!env["devise.skip_storage"]
end
# Checks if a valid scope was given for devise and find mapping based on this scope.
def mapping
@mapping ||= begin
mapping = Devise.mappings[scope]
raise "Could not find mapping for #{scope}" unless mapping
mapping
end
end
end
end
end
|