mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
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<OpenIddictServerEvents.HandleLogoutRequestContext>
|
|
{
|
|
protected readonly SignInManager<ApplicationUser> _signInManager;
|
|
public static OpenIddictServerHandlerDescriptor Descriptor { get; } =
|
|
OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.HandleLogoutRequestContext>()
|
|
.UseScopedHandler<LogoutEventHandler>()
|
|
.Build();
|
|
public LogoutEventHandler(SignInManager<ApplicationUser> signInManager)
|
|
{
|
|
_signInManager = signInManager;
|
|
}
|
|
|
|
public async ValueTask HandleAsync(
|
|
OpenIddictServerEvents.HandleLogoutRequestContext notification)
|
|
{
|
|
await _signInManager.SignOutAsync();
|
|
}
|
|
}
|
|
}
|