Sha256: c276746c9c0fd8e164f5b49f42dc4f5a946604c05c15b8644ecb06421fec370f

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

# encoding: utf-8
# frozen_string_literal: true
module Warden
  module Mixins
    module Common

      # Convenience method to access the session
      # :api: public
      def session
        env['rack.session']
      end # session

      # Alias :session to :raw_session since the former will be user API for storing scoped data.
      alias :raw_session :session

      # Convenience method to access the rack request.
      # :api: public
      def request
        @request ||= Rack::Request.new(@env)
      end # request

      # Provides a warden repository for cookies. Those are sent to the client
      # when the response is streamed back from the app.
      # :api: public
      def warden_cookies
        warn "warden_cookies was never functional and is going to be removed in next versions"
        env['warden.cookies'] ||= {}
      end # warden_cookies

      # Convenience method to access the rack request params
      # :api: public
      def params
        request.params
      end # params

      # Resets the session.  By using this non-hash like sessions can
      # be cleared by overwriting this method in a plugin
      # @api overwritable
      def reset_session!
        raw_session.clear
      end # reset_session!

    end # Common
  end # Mixins
end # Warden

Version data entries

7 entries across 6 versions & 4 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/warden-1.2.9/lib/warden/mixins/common.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/warden-1.2.9/lib/warden/mixins/common.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/warden-1.2.9/lib/warden/mixins/common.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/warden-1.2.9/lib/warden/mixins/common.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/warden-1.2.9/lib/warden/mixins/common.rb
warden-1.2.9 lib/warden/mixins/common.rb
warden-1.2.8 lib/warden/mixins/common.rb