Does anybody know what the correct way to cache results from Net::LDAP bind_as? I've been struggling for about a day now and I know it's something really easy. But when ever I do something like this -
def self.login(username, password) begin ldap = Net::LDAP.new ldap.host = "192.168.1.16" ldap.port = 389
result = ldap.bind_as( :base => "dc=net", :filter => "(cn=#{username})", :password => password )
@dn = result.first.dn rescue => e false end
end
and in my controller I do
if request.post?
session[:user_id] = AuthUser.login(params[:user]["username"], params[:user]["password"])
end
My server returns a 500 error. I've tried from lighttpd and locomotive. Both return the same generic error. I suspect it's related to the object returned is not compatible with the marshal_dump. So the question is how do I copy the values from the result set into my session object? Sorry if this is a stupid noobie question but I am one so.
Thanks in advance. Phill