Project

General

Profile

0001-fixes-1300-with-REMOTE_USER-support.patch

Romain Vrignaud, 11/15/2011 12:00 PM

View differences:

app/controllers/application_controller.rb
63 63
          logger.warn("Failed authentcation from #{request.remote_ip} #{user}") if User.current.nil?
64 64
          return !User.current.nil?
65 65
        end
66
	# if login delegation authorized and REMOTE_USER not empty, authenticate user without using password
67
	if SETTINGS[:authorize_login_delegation] == true and !request.env["REMOTE_USER"].nil?
68
	  user = User.find_by_login(request.env["REMOTE_USER"])
69
	  User.current = user.is_a?(User) ? user : nil
70
	  if !user.nil? 
71
	    session[:user] = User.current.id
72
	    return !User.current.nil?
73
	  else 
74
	    logger.warn("Failed authentcation from REMOTE_USER") if User.current.nil?
75
	  end
76
	end
66 77
        session[:original_uri] = request.request_uri # keep the old request uri that we can redirect later on
67 78
        redirect_to login_users_path and return
68 79
      else
69
-