36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
// Copyright (c) Duende Software. All rights reserved.
|
|
// See LICENSE in the project root for license information.
|
|
|
|
using Duende.IdentityServer.Services;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
|
|
namespace Yavsc.Pages.Logout;
|
|
|
|
[SecurityHeaders]
|
|
[AllowAnonymous]
|
|
public class LoggedOut : PageModel
|
|
{
|
|
private readonly IIdentityServerInteractionService _interactionService;
|
|
|
|
public LoggedOutViewModel View { get; set; } = default!;
|
|
|
|
public LoggedOut(IIdentityServerInteractionService interactionService)
|
|
{
|
|
_interactionService = interactionService;
|
|
}
|
|
|
|
public async Task OnGet(string? logoutId)
|
|
{
|
|
// get context information (client name, post logout redirect URI and iframe for federated signout)
|
|
var logout = await _interactionService.GetLogoutContextAsync(logoutId);
|
|
|
|
View = new LoggedOutViewModel
|
|
{
|
|
AutomaticRedirectAfterSignOut = LogoutOptions.AutomaticRedirectAfterSignOut,
|
|
PostLogoutRedirectUri = logout?.PostLogoutRedirectUri,
|
|
ClientName = String.IsNullOrEmpty(logout?.ClientName) ? logout?.ClientId : logout?.ClientName,
|
|
SignOutIframeUrl = logout?.SignOutIFrameUrl
|
|
};
|
|
}
|
|
}
|