Sha256: 944c5fc0832c79396af016ac0b9a082bc956180736cdc18df3e6e6739af0ccd5

Contents?: true

Size: 537 Bytes

Versions: 5

Compression:

Stored size: 537 Bytes

Contents

module DceLti
  module ControllerMethods
    def authenticate_via_lti
      if ! current_user
        redirect_to Engine.routes.url_helpers.invalid_sessions_path
      end
    end

    def current_user
      @current_user ||=
        if ENV['FAKE_USER_ID']
          User.find_by(id: ENV['FAKE_USER_ID'])
        else
          User.find_by(id: session[:current_user_id])
        end
    end

    def cookieless_session?
      cookie = env.fetch('HTTP_COOKIE', '')
      cookie.blank? || cookie.match(/shimmed_cookie/)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dce_lti-0.5.4 lib/dce_lti/controller_methods.rb
dce_lti-0.5.3 lib/dce_lti/controller_methods.rb
dce_lti-0.5.2 lib/dce_lti/controller_methods.rb
dce_lti-0.5.1 lib/dce_lti/controller_methods.rb
dce_lti-0.5.0 lib/dce_lti/controller_methods.rb