我正在使用 owin openid connect 身份验证,其中身份验证提供程序托管在单独的域上。身份验证过程运行良好。在身份服务器成功登录后,我能够查看受限页面。
但我希望外部身份服务器返回到“account/SignInCallback”控制器操作,以便我可以执行与成员帐户相关的几行代码。在浏览器的网络活动中,它向我显示“account/SignInCallback”的“302 Found”,但它没有命中附加的断点。它直接转到请求发起 URL,例如“帐户/仪表板”。
有没有办法可以强制系统在登录后返回特定的网址,即使请求的网址不同?
public class AccountController : BaseController
{
public AccountController() : base()
{
}
[Authorize]
public ActionResult Dashboard()
{
return View();
}
[HttpPost]
[AllowAnonymous]
public ActionResult SignInCallback()
{
if (User.Identity.IsAuthenticated)
{
// Read claims and execute member specific codes
}
return View();
}
[AllowAnonymous]
public ActionResult Unauthorized()
{
return View();
}
}
Run Code Online (Sandbox Code Playgroud)
启动类如下:
public sealed class Startup
{
public void Configuration(IAppBuilder app)
{
string ClientCallbackUri = @"https://client.local/account/SignInCallback";
string IdServBaseUri = @"https://idm.website.com/core";
string TokenEndpoint …Run Code Online (Sandbox Code Playgroud)