Post-Logout Redirect with ASP.NET Core and ADFS 2016 - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Sunday, September 30, 2018

Post-Logout Redirect with ASP.NET Core and ADFS 2016

Redirect after logout When a user logs out from your app you have the option to log them out of the provider as well by redirecting the browser to the logout endpoint. By default this means that the user will end up sat on your providers "You have signed out" page – not brilliant. You can, however, tell your provider to redirect back to your app once they're done with logout by specifying a post_logout_redirect_url. For ASP.NET Core Identity you can specify this redirection as a parameter on the SignOutResult. [Route("auth")] public class AuthController { [HttpPost("logout")] public IActionResult Logout() = new SignOutResult( OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties { RedirectUri = Url.Action(nameof(LogoutSuccess))}); [HttpGet("logoutSuccess")] public IActionResult LogoutSuccess() = View(); } Useless ADFS error messages For ADFS 2016 you need to do a little bit more than just set the redirect URL. On first inspection you can see that the above will set the parameter in the ADFS URL but ADFS will silently ignore it and your user will sit forever on the ADFS sign-out page.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

.NET Core,ASP.NET,Core,Development,adfs,authentication,software-development,web

No comments:

Post a Comment