mirror of https://github.com/abpframework/abp.git
4 changed files with 75 additions and 0 deletions
@ -0,0 +1,44 @@ |
|||
using IdentityServer4.Services; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.Account.Web.Pages.Account |
|||
{ |
|||
[ExposeServices(typeof(LogoutModel))] |
|||
public class IdentityServerSupportedLogoutModel : LogoutModel |
|||
{ |
|||
protected IIdentityServerInteractionService Interaction { get; } |
|||
|
|||
public IdentityServerSupportedLogoutModel(IIdentityServerInteractionService interaction) |
|||
{ |
|||
Interaction = interaction; |
|||
} |
|||
|
|||
public override async Task<IActionResult> OnGetAsync() |
|||
{ |
|||
await SignInManager.SignOutAsync().ConfigureAwait(false); |
|||
|
|||
var logoutId = Request.Query["logoutId"].ToString(); |
|||
|
|||
if (!string.IsNullOrEmpty(logoutId)) |
|||
{ |
|||
var logoutContext = await Interaction.GetLogoutContextAsync(logoutId).ConfigureAwait(false); |
|||
|
|||
var postLogoutUri = logoutContext.PostLogoutRedirectUri; |
|||
|
|||
if (!string.IsNullOrEmpty(postLogoutUri)) |
|||
{ |
|||
return Redirect(postLogoutUri); |
|||
} |
|||
} |
|||
|
|||
if (ReturnUrl != null) |
|||
{ |
|||
return LocalRedirect(ReturnUrl); |
|||
} |
|||
|
|||
return RedirectToPage("/Account/Login"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
@page "/Account/Logout" |
|||
@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage |
|||
@model Volo.Abp.Account.Web.Pages.Account.LogoutModel |
|||
@ -0,0 +1,27 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace Volo.Abp.Account.Web.Pages.Account |
|||
{ |
|||
public class LogoutModel : AccountPageModel |
|||
{ |
|||
[HiddenInput] |
|||
[BindProperty(SupportsGet = true)] |
|||
public string ReturnUrl { get; set; } |
|||
|
|||
[HiddenInput] |
|||
[BindProperty(SupportsGet = true)] |
|||
public string ReturnUrlHash { get; set; } |
|||
|
|||
public virtual async Task<IActionResult> OnGetAsync() |
|||
{ |
|||
await SignInManager.SignOutAsync().ConfigureAwait(false); |
|||
if (ReturnUrl != null) |
|||
{ |
|||
return RedirectSafely(ReturnUrl, ReturnUrlHash); |
|||
} |
|||
|
|||
return RedirectToPage("/Account/Login"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue