This message aims to get some consensus on error handling when an OpenID rely party tries to authenticate with an OpenID provider and the best means modify DotNetOpenAuth to implement it. As for the latter, I'd appreciate some guidance.
Assume that a OpenID relay party (
https://rp.example.com) is trying to authenticate with an OpenID provider (
https://op.example.com). Research at this point has highlighted the following potential issues when the RP wants to authenticate using the OP. If you know of additional ones, please let me know.
- The host of the OP is incorrect, or it doesn't exist
- The host of the OP is correct and the connection is dropped (as IIS/WCF does when the request is too large)
- The host of the OP exists and never responds within a given time period
- The host of the OP exists and returns HTTP Status 30x
- The host of the OP exists and returns HTTP Status 400
- The host of the OP exists and returns HTTP Status 401
- The host of the OP exists and returns HTTP Status 403
- The host of the OP exists and returns HTTP Status 404
- The host of the OP exists and returns HTTP Status 500
- The host of the OP exists and returns HTTP Status 503
- The host of the OP exists and returns HTTP Status 504
- The host of the OP exists, returns HTTP Status 200 but an invalid XRDS document
- The host of the OP exists, returns HTTP Status 200, but no XRDS document
- The host of the OP exists, returns HTTP Status 200, but the HTML returned does satisfy HTML discovery
Some of these conditions may temporary (such as HTTP status 503), other permanent (i.e. host doesn't exist). In any case, an appropriate exception should be thrown by DotNetOpenAuth so that the OpenID rely party can handle it accordingly.
Here are some requirements for that exception:
- The exception message should support localization
- The OpenID rely party should be able to determine the underlying error without having to analyze the message.
- The exception should be as comprehensive as possible, as it may be logged in isolation and may be the only source to diagnose an issue. This assumes that there are multiple OpenID rely parties and providers running on the same physical host.
- Messages should not contain abbreviations as this poses problems for support personnel.
The exception may encapsulate:
- source of the request (https://rp.example.com/signin), to differentiate one OpenID rely party from another.
- destination of the request (https://op.example.com), to differentiate one OpenID provider from another.
- an correlation identifier to differentiate one flow from another
- a reason to diagnose the issue
- an corrective action, if possible
Here are examples of messages that may be more appropriate:
- When HTML discovery fails: "Failed to discover the OpenID provider endpoint using the HTML Discovery method at https://op.example.com/. The realm used trying to perform the discovery was https://rp.example.com".
- When XRDS fails because the XRDS document is malformed: "Failed to discover the OpenID provider endpoint using XRDS discovery method at https://op.example.com/. The OpenID provider returned a XRDS document, but the document was malformed. The realm used trying to perform the discovery was https://rp.example.com.".
- When the OP doesn't respond in a reasonable time: "Failed to discover the OpenID provider endpoint using XRDS and HTML discovery methods at https://op.example.com/. The OpenID provider did not respond within a reasonable time (00:00:10). The realm used trying to perform the discovery was https://rp.example.com."
Does anyone have anything to add? If not, any suggestions how to best approach implementing it?
Werner
PS. Much of the same requirements may apply to other parts of the DotNetOpenAuth, such as OpenID provider and OAuth components.