Reputation: 536
In my handler code trying to return the redirect response with necessary openid headers/body to do the user-agent redirection to do the authentication, but when I set the return response with HTTPEntity in the Operation result I get 406 Not acceptable on the client? What is wrong with that? The following code is not complete and is of prototype quality!
Here is the my handler code:
private static OpenIdRelyingParty openid = new OpenIdRelyingParty();
public OperationResult Get(string contentId)
{
var response = openid.GetResponse();
Identifier id;
Identifier.TryParse("https://www.google.com/accounts/o8/id", out id);
OutgoingWebResponse owr = openid.CreateRequest(id).RedirectingResponse;
HttpEntity he = new HttpEntity(new HttpHeaderDictionary(owr.Headers), owr.ResponseStream);
return new OperationResult.SeeOther { ResponseResource = he };
}
Upvotes: 0
Views: 326
Reputation: 6766
We don't support IMessage / IHttpEntity / IResponse as return types at the moment, so that wouldn't work (but it would be great if it did, and it probably should).
The problem right now is that IRequest / IResponse (and associated entity bodies) are controlled by the hosting environment.
If you want it to work as is, I'd suggest creating a custom codec, register it on IHttpEntity (ResourceSpace.Has.ResourcesOfType().WithoutUri.TranscodedBy()) and use that codec to copy the headers and the body on the existing IResponse, which should take you 5 LOC.
I've open a bug on https://github.com/openrasta/openrasta-core/issues/33 so we can move this into the core.
Upvotes: 1