Sha256: bd776f8b3419517513a160af3084b56fd1c35ee39382d9c4d735bff3b13e05a1

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

module Martinet
  # HTTP/Warden session-specific behavior.
  class Session
    def initialize(warden)
      # TODO: Move this to Martinet::Impersonation class
      if Martinet.configuration.enable_impersonation
        class << self; include Impersonation; end
      end

      @warden = warden
    end

    def current_user(scope: nil)
      @warden.user(scope)
    end

    def signed_in?(scope: nil)
      @warden.authenticated?(scope)
    end

    def sign_in!(user, *args)
      @warden.set_user(user, *args)
    end

    def sign_out!(scope: nil)
      if scope
        @warden.logout(scope)
      else
        @warden.logout
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
martinet-0.0.4 lib/martinet/session.rb