Sha256: c7c45b52e8435c9a864e93d604e385bbdd9ca8b9a56b6ae906aeb2ea3d2e484d

Contents?: true

Size: 768 Bytes

Versions: 9

Compression:

Stored size: 768 Bytes

Contents

module Sso
  module Warden
    module Support
      extend ActiveSupport::Concern
      include ::Sso::Logging

      included do
        attr_reader :user, :warden, :options
        delegate :request, to: :warden
        delegate :params, to: :request
      end

      module ClassMethods
        def to_proc
          proc do |user, warden, options|
            new(user, warden, options).call
          end
        end
      end

      def initialize(user, warden, options)
        @user, @warden, @options = user, warden, options
      end

      def scope
        scope = options[:scope]
      end

      def session
        warden.session(scope)
      end

      def logged_in?
        warden.authenticated?(scope) && session && user
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
doorkeeper_sso-0.4.9 lib/sso/warden/support.rb
doorkeeper_sso-0.4.8 lib/sso/warden/support.rb
doorkeeper_sso-0.4.6 lib/sso/warden/support.rb
doorkeeper_sso-0.4.3 lib/sso/warden/support.rb
doorkeeper_sso-0.4.1 lib/sso/warden/support.rb
doorkeeper_sso-0.4.0 lib/sso/warden/support.rb
doorkeeper_sso-0.2.7 lib/sso/warden/support.rb
doorkeeper_sso-0.2.6 lib/sso/warden/support.rb
doorkeeper_sso-0.2.5 lib/sso/warden/support.rb