Skip to content

Instantly share code, notes, and snippets.

def auth_by_eso( username, password )
begin
driver = SOAP::WSDLDriverFactory.new(ESO_WEB_SERVICE_URL).create_rpc_driver
result = driver.Authenticate( { :username => username, :password => password} )
result.authenticateResult == 'VALID_USER'
rescue
logger.info " >> ESO authentication failed for #{params[:action]} in #{params[:id]}"
false
end
end
def authenticate
authenticate_or_request_with_http_basic do | username,password |
return false if username.blank? || password.blank?
username.strip!.downcase!
# Check to see if this request provides a session cookie.
# If the user id is in the session database, they pass right thru
@current_user = User.find_by_username( session[:user_id] ) if session[:user_id]
return if @current_user