Browse Source

Set RedirectUri property of AuthenticationProperties.

pull/8002/head
maliming 6 years ago
parent
commit
8bcd415822
  1. 24
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs

24
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs

@ -23,20 +23,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Authentication
{ {
return RedirectSafely(returnUrl, returnUrlHash); return RedirectSafely(returnUrl, returnUrlHash);
} }
else
{ return Challenge(new AuthenticationProperties {RedirectUri = returnUrl}, ChallengeAuthenticationSchemas);
return Challenge(
new AuthenticationProperties
{
Parameters =
{
{"returnUrl", returnUrl},
{"returnUrlHash", returnUrlHash}
}
},
ChallengeAuthenticationSchemas
);
}
} }
[HttpGet] [HttpGet]
@ -44,20 +32,20 @@ namespace Volo.Abp.AspNetCore.Mvc.Authentication
{ {
await HttpContext.SignOutAsync(); await HttpContext.SignOutAsync();
if (HttpContext.User.Identity.AuthenticationType == AuthenticationType) if (HttpContext.User.Identity?.AuthenticationType == AuthenticationType)
{ {
return RedirectSafely(returnUrl, returnUrlHash); return RedirectSafely(returnUrl, returnUrlHash);
} }
return new SignOutResult(ChallengeAuthenticationSchemas); return SignOut(new AuthenticationProperties {RedirectUri = returnUrl}, ChallengeAuthenticationSchemas);
} }
[HttpGet] [HttpGet]
public async Task<IActionResult> FrontChannelLogout(string sid) public async Task<IActionResult> FrontChannelLogout(string sid)
{ {
if (User.Identity.IsAuthenticated) if (User.Identity != null && User.Identity.IsAuthenticated)
{ {
var currentSid = User.FindFirst("sid").Value ?? string.Empty; var currentSid = User.FindFirst("sid")?.Value ?? string.Empty;
if (string.Equals(currentSid, sid, StringComparison.Ordinal)) if (string.Equals(currentSid, sid, StringComparison.Ordinal))
{ {
await Logout(); await Logout();

Loading…
Cancel
Save