AD kimlik doğrulamasıyla Azure'da MVC Web Uygulaması var. Web sitesini yerel olarak çalıştırdığımda, Azure AD'yi kullanarak oturum açıp kapatabilir. Ancak dağıtılan Azure web sitemdeki oturum çalışmıyor. Kullanıcı kimliği doğrulanmış olarak kalır, bu nedenle SignOutCallback eylemi her zaman Ana/Dizine yönlendirir.OWIN - Authentication.SignOut() çerezleri kaldırmıyor
Bu, projeyi oluşturduğumda oluşturulan kullanıma hazır koddur.
public class AccountController : Controller
{
/// <summary>
/// Use this method to sign into the website
/// </summary>
public void SignIn()
{
// Send an OpenID Connect sign-in request.
if (!Request.IsAuthenticated)
{
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/" },
OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
}
/// <summary>
/// Use this method to sign out of the website
/// </summary>
public void SignOut()
{
string callbackUrl = Url.Action("SignOutCallback", "Account", routeValues: null, protocol: Request.Url.Scheme);
Request.GetOwinContext().Authentication.SignOut(
new AuthenticationProperties { RedirectUri = callbackUrl },
OpenIdConnectAuthenticationDefaults.AuthenticationType,
CookieAuthenticationDefaults.AuthenticationType);
}
/// <summary>
/// Use this method to redirect to Home page, once the request has been authenticated
/// </summary>
/// <returns>An <see cref="ActionResult"/> object.</returns>
public ActionResult SignOutCallback()
{
if (Request.IsAuthenticated)
{
// Redirect to home page if the user is authenticated.
return RedirectToAction("Index", "Home");
}
return View();
}
}
Ben benzer sorunlarla bir yazı
here buldum ve önerdi denedi ama benim için işe yaramadı.
Bu sorunla karşılaşan başka biri var mı?