module ProxyAuthentication::Helpers

Public Class Methods

included(mod) click to toggle source
# File lib/proxy_authentication/helpers.rb, line 5
def self.included mod
  mod.helper_method :current_user, :user_signed_in?
end

Public Instance Methods

current_user() click to toggle source
# File lib/proxy_authentication/helpers.rb, line 9
def current_user
  @current_user ||= warden.user
end
user_signed_in?() click to toggle source
# File lib/proxy_authentication/helpers.rb, line 13
def user_signed_in?
  !!current_user
end

Private Instance Methods

authenticate_user_from_token!() click to toggle source
# File lib/proxy_authentication/helpers.rb, line 19
def authenticate_user_from_token!
  warden.logout if warden.authenticated? && params['u'].present?
  warden.authenticate
  redirect_to ProxyAuthentication.redirect_to_if_authentication_failed if warden.unauthenticated?
end
warden() click to toggle source
# File lib/proxy_authentication/helpers.rb, line 25
def warden
  request.env['warden']
end