using System; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Models; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Options; using OpenIddict.Core; using OpenIddict.Server; using Microsoft.AspNetCore; using OpenIddict.Server.AspNetCore; namespace BTCPayServer.Security.OpenId { public class LogoutEventHandler : IOpenIddictServerHandler { protected readonly SignInManager _signInManager; public static OpenIddictServerHandlerDescriptor Descriptor { get; } = OpenIddictServerHandlerDescriptor.CreateBuilder() .UseScopedHandler() .Build(); public LogoutEventHandler(SignInManager signInManager) { _signInManager = signInManager; } public async ValueTask HandleAsync( OpenIddictServerEvents.HandleLogoutRequestContext notification) { await _signInManager.SignOutAsync(); } } }