【发布时间】:2015-07-30 13:58:04
【问题描述】:
本题是关于在 Asp.net Wep Api 中使用 Owin 实现授权码流程的。
我试图处理一些在我的 AuthorizationCode 代码创建时可能发生的错误。显然,我无法使用正确的错误代码“server_error”将自己重定向到客户端重定向 URI
以下是我的代码:
private static void CreateAuthorizationCode(AuthenticationTokenCreateContext context)
{
try
{
//Some Code to create and save the AuthorizationCode that can throw an Exception
context.SetToken(code);
}
catch (Exception ex)
{
logger.Fatal(ex);
var redirectUri = GetRedirectUri();
var redirectLocation = string.Format("{0}?code={1}", redirectUri, "server_error");
context.Response.Redirect(redirectLocation);
}
}
但是我被框架重定向到带有 https://redirecturi?error=unsupported_response_type 的重定向 Uri !
这是正常行为吗?或者也许有任何其他方法可以处理这种情况并自己设置错误代码!?
PS:我在 Github 上创建了一个关于该问题的问题:https://github.com/aspnet/Security/issues/375 目前没有答案!
谢谢。
【问题讨论】:
标签: oauth-2.0 asp.net-web-api2 owin katana