class OpenShift::RemoteUserAuthService

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/openshift/remote_user_auth_service.rb, line 8
def initialize
  super

  @trusted_header = @auth_info[:trusted_header]
end

Public Instance Methods

authenticate(request, login=nil, password=nil) click to toggle source

The base_controller will actually pass in a password but it can’t be trusted. REMOTE_USER must only be set if the web server has verified the password.

# File lib/openshift/remote_user_auth_service.rb, line 17
def authenticate(request, login=nil, password=nil)
  if request.headers['User-Agent'] == "OpenShift"
    # password == iv, login == key
    return validate_broker_key(password, login)
  else
    authenticated_user = request.env[@trusted_header]
    raise OpenShift::AccessDeniedException if authenticated_user.nil?
    return {:username => authenticated_user, :auth_method => :login}
  end
end
login(request, params, cookies) click to toggle source

This is only called by the legacy controller and should be removed as soon as all clients have been ported.

# File lib/openshift/remote_user_auth_service.rb, line 30
def login(request, params, cookies)
  if params['broker_auth_key'] && params['broker_auth_iv']
    return validate_broker_key(params['broker_auth_iv'], params['broker_auth_key'])
  else
    username = request.env[@trusted_header]
    Rails.logger.debug("Found" + username)
    return authenticate(request, username)
  end
end