Cookies overwriting request data

12 views
Skip to first unread message

hcoverlambda

unread,
Jul 24, 2014, 5:57:46 PM7/24/14
to fubumv...@googlegroups.com
So we just updated to the latest fubu (We were pretty behind) and we are having a problem where cookies are overwriting posted data in our input models. Our login page has an input model with AccountKey and Username, but we also have cookies with those same names that are used just by our angular app for defaults. Evidently in older versions of fubu the posted data must have taken precedence over the cookies in the model binding but now it seems its the other way around. So when people login its using the values stored in the cookies not the values they posted. It's causing a ton of problems for us so if anyone has any ideas on how to disable the cookies from being bound that would be great. I found where the cookie value source is added in FubuMVC.Core.Http.FubuMvcRequestData but I'm not seeing a way to control what value sources are enabled.

TIA,

m

hcoverlambda

unread,
Jul 24, 2014, 6:02:39 PM7/24/14
to fubumv...@googlegroups.com
Actually, as soon as I posted that it dawned on me that this might be how I have our formatter setup:

public object Read(Type type)
{
    var model = _request.GetMethod() == HttpMethod.Post || _request.GetMethod() == HttpMethod.Put ?
        Deserialize(type, _streaming.Input) : Activator.CreateInstance(type);
    var requestData = !_formatterOptions.BindingSources.Any() ? _requestData : 
        new RequestData(_formatterOptions.BindingSources.Distinct().Select(x => _requestData.ValuesFor(x)));
    _objectResolver.BindProperties(type, model, new BindingContext(requestData, _serviceLocator, new NulloBindingLogger()));
    return model;
}

I am binding the properties right after I deserialize so I can see how this could overwrite. Still unsure why this worked before but not after we upgraded. I wonder if the object resolver checked to see if a value was already set before setting it and now it doesn't?

hcoverlambda

unread,
Jul 24, 2014, 6:06:29 PM7/24/14
to fubumv...@googlegroups.com
NM, I'm an idiot. Evidently we ran into this before and I filtered out cookies from the binding source. But something changed and my filter stopped working, so definitely on my end.

Nothing to see here...
Reply all
Reply to author
Forward
0 new messages