mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-18 21:32:27 +01:00
27 lines
917 B
C#
27 lines
917 B
C#
|
using System;
|
||
|
using Microsoft.AspNetCore.DataProtection;
|
||
|
using Microsoft.AspNetCore.Identity;
|
||
|
using Microsoft.Extensions.Logging;
|
||
|
using Microsoft.Extensions.Options;
|
||
|
|
||
|
namespace BTCPayServer.Security;
|
||
|
|
||
|
// https://andrewlock.net/implementing-custom-token-providers-for-passwordless-authentication-in-asp-net-core-identity/
|
||
|
public class InvitationTokenProviderOptions : DataProtectionTokenProviderOptions
|
||
|
{
|
||
|
public const string ProviderName = "InvitationTokenProvider";
|
||
|
|
||
|
public InvitationTokenProviderOptions()
|
||
|
{
|
||
|
Name = ProviderName;
|
||
|
TokenLifespan = TimeSpan.FromDays(7);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public class InvitationTokenProvider<TUser>(
|
||
|
IDataProtectionProvider dataProtectionProvider,
|
||
|
IOptions<InvitationTokenProviderOptions> options,
|
||
|
ILogger<DataProtectorTokenProvider<TUser>> logger)
|
||
|
: DataProtectorTokenProvider<TUser>(dataProtectionProvider, options, logger)
|
||
|
where TUser : class;
|