parent
86c88a7dca
commit
a4557135b7
@ -0,0 +1,11 @@
|
|||||||
|
namespace Infrastructure.Extensions;
|
||||||
|
|
||||||
|
public static class EncryptionSetup
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddAesEncryption(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(services);
|
||||||
|
services.TryAddSingleton<IEncryptionService, EncryptionService>();
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
namespace Infrastructure.Extensions;
|
||||||
|
|
||||||
|
public static class TokenContextSetup
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddDefaultTokenContext(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(services);
|
||||||
|
services.TryAddSingleton<JwtSecurityTokenHandler>();
|
||||||
|
services.TryAddSingleton<DefaultTokenHandler>();
|
||||||
|
services.TryAddSingleton<ITokenBuilder, DefaultTokenBuilder>();
|
||||||
|
var builder = new DefaultTokenBuilder(null, null, null);
|
||||||
|
builder.SetUserContext(null);
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
namespace Infrastructure.Extensions;
|
||||||
|
|
||||||
|
public static class UserContextSetup
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddDefaultUserContext(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
ArgumentNullException.ThrowIfNull(services);
|
||||||
|
services.TryAddScoped(typeof(IUserContext<>), typeof(DefaultUserContext));
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
namespace Infrastructure.Security;
|
||||||
|
|
||||||
|
public class DefaultUserContext : UserContextBase<long>
|
||||||
|
{
|
||||||
|
}
|
Loading…
Reference in new issue