Oauth IdentityServer3注销未重定向到源站
我让MVC从identityserver注销,但它不会自动重定向。我甚至没有默认显示的“单击此处返回” 这是我的设置 在idsvr中: 工厂是使用EF的Aspnet标识(主要是开箱即用的实现) 在MVC中Oauth IdentityServer3注销未重定向到源站,oauth,oauth-2.0,identityserver3,openid-connect,thinktecture-ident-server,Oauth,Oauth 2.0,Identityserver3,Openid Connect,Thinktecture Ident Server,我让MVC从identityserver注销,但它不会自动重定向。我甚至没有默认显示的“单击此处返回” 这是我的设置 在idsvr中: 工厂是使用EF的Aspnet标识(主要是开箱即用的实现) 在MVC中 app.UseOpenIdConnectAuthentication (new OpenIdConnectAuthenticationOptions { PostLogoutRedirectUri = "https://localhost:port", RedirectUri = "https
app.UseOpenIdConnectAuthentication (new OpenIdConnectAuthenticationOptions
{
PostLogoutRedirectUri = "https://localhost:port",
RedirectUri = "https://localhost:port",
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = HereIGetRefreshTokenEtc(),
RedirectToIdentityProvider = n =>
{
if (n.ProtocolMessage.RequestType == OpenIdConnectRequestType.LogoutRequest)
{
var idTokenHint = n.OwinContext.Authentication.User.FindFirst("id_token");
if (idTokenHint != null)
{
n.ProtocolMessage.IdTokenHint = idTokenHint.Value;
}
}
return Task.FromResult(0);
}
}
});
注销控制器操作如下
public ActionResult Logout()
{
//Option 1 : because I have already provided redirect URI in initial configuration
Request.GetOwinContext().Authentication.SignOut();
//Option 2: Because option 1 did not work
Request.GetOwinContext().Authentication.SignOut(new AuthenticationProperties { RedirectUri = "https://mymvc.site" });
//none of the return statements work. (obviously i have tried them individually)
return RedirectToAction("Index", "Home", new{ area = ""});
return Redirect("https://idsvr/connect/endsession");
}
我错过了什么?明白了!
我在客户端配置的PostLogoutRedirectUris中没有添加链接。说“无效的注销后URI”时出错了。明白了!
我在客户端配置的PostLogoutRedirectUris中没有添加链接。说“无效的注销后URI”是错误的
public ActionResult Logout()
{
//Option 1 : because I have already provided redirect URI in initial configuration
Request.GetOwinContext().Authentication.SignOut();
//Option 2: Because option 1 did not work
Request.GetOwinContext().Authentication.SignOut(new AuthenticationProperties { RedirectUri = "https://mymvc.site" });
//none of the return statements work. (obviously i have tried them individually)
return RedirectToAction("Index", "Home", new{ area = ""});
return Redirect("https://idsvr/connect/endsession");
}