duosecurity/duo_universal_csharp

Failed Health Check Responses Deserialize to null

sdepouw opened this issue · 4 comments

Was running this locally today, and was debugging why my calls were not working. The health check was failing, but while I could verify the response message was FAIL (as opposed to OK), the response detail object is not being correctly deserialized.

DoPost<T> tries to deserialize the result to an instance of T, but while I get a response detail object back:

image

The actual C# object is just set to null.

It's likely just a case of the properties being returned not matching the properties of the response object itself, but upon failure this should be deserialized appropriately.

@sdepouw Thanks for catching this. I think I see the problem. The documentation on our website indicates that the code, timestamp, message, and message_detail properties will be wrapped up in a 'response' property that is a sibling of the 'stat' property: https://duo.com/docs/oauthapi#health-check

And that is in fact what the C# code expects to deserialize to: https://github.com/duosecurity/duo_universal_csharp/blob/main/DuoUniversal/Models.cs#L13 and
https://github.com/duosecurity/duo_universal_csharp/blob/main/DuoUniversal/Models.cs#L19

But from your example seems to suggest that Duo is actually sending those properties at the top level instead. Let me chase this down with the folks who maintain the prompt to see which behavior is actually expected.

It does look like the documentation on our website was inaccurate - so we're going to update that and I'll try to get this client code changed soon.

@sdepouw Should be fixed by 9d50a24. Note that the structure of the object will depend on whether the response is a success or not. I'll get a new release made within the next day or so.

1.2.0 has been released and fixes this