Sha256: 64bb1f7673574e216b1a4cc0bd971b8a99189c63369e90177a2d0f6f67eed8c5

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

module Kingsman
  module Strategies
    # Base strategy for Kingsman. 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["kingsman.skip_storage"]
      end

      # Checks if a valid scope was given for kingsman and find mapping based on this scope.
      def mapping
        @mapping ||= begin
          mapping = Kingsman.mappings[scope]
          raise "Could not find mapping for #{scope}" unless mapping
          mapping
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kingsman-0.1.1 lib/kingsman/strategies/base.rb
kingsman-0.1.0 lib/kingsman/strategies/base.rb