現在、DotNetOpenAuth CTPバージョンを使用してOAuth2認証サーバーを開発しています。私の認証サーバーはasp.net MVC3にあり、ライブラリによって提供されたサンプルに基づいています。アプリがコンシューマクライアントを認証するポイントに達するまで、すべてのことがうまく動作します。PrepareResponse()。AsActionResult()はサポートされていない例外をスローしますDotNetOpenAuth CTP
承認プロセスの世話をする、試料中の同等のアクションに非常によく似ている私のOAuthコントローラ内部のアクションがあります:
[Authorize, HttpPost, ValidateAntiForgeryToken]
public ActionResult AuthorizeResponse(bool isApproved)
{
var pendingRequest = this.authorizationServer.ReadAuthorizationRequest();
if (pendingRequest == null)
{
throw new HttpException((int)HttpStatusCode.BadRequest, "Missing authorization request.");
}
IDirectedProtocolMessage response;
if (isApproved)
{
var client = MvcApplication.DataContext.Clients.First(c => c.ClientIdentifier == pendingRequest.ClientIdentifier);
client.ClientAuthorizations.Add(
new ClientAuthorization
{
Scope = OAuthUtilities.JoinScopes(pendingRequest.Scope),
User = MvcApplication.LoggedInUser,
CreatedOn = DateTime.UtcNow,
});
MvcApplication.DataContext.SaveChanges();
response = this.authorizationServer.PrepareApproveAuthorizationRequest(pendingRequest, User.Identity.Name);
}
else
{
response = this.authorizationServer.PrepareRejectAuthorizationRequest(pendingRequest);
}
return this.authorizationServer.Channel.PrepareResponse(response).AsActionResult();
}
は毎回プログラムがこの行に到達:
this.authorizationServer.Channel.PrepareResponse(response).AsActionResult();
システムは私が研究した例外をスローし、成功しません。例外は次のとおりです。 LINQ to Entitiesでは、パラメータのないコンストラクタと初期化子のみがサポートされています。
スタックトレース:http://pastebin.com/TibCax2t
私はサンプルとは異なってやった唯一の事は、私は、私はサンプルがエンティティを自動生成デザイナーを使用して行われていたと思いますが、エンティティフレームワークのコードの最初のアプローチを使用したことです。
ありがとうございます。
これを把握しましたか?私は同じ問題を抱えています。 – fuzz