mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 17:11:10 +00:00
Implements Authorization system
This commit is contained in:
1 parent
5bfb2ca212
commit
2c9c210e43
68 files changed
+2734
-336
No files matched your search
+4
-1
@@ -76,7 +76,10 @@ public class AuthenticatedLuminaApiFactory : LuminaApiFactory, IDisposable
|
||||
Username = TestUsername!,
|
||||
Password = _hashService.HashString("TestPass123!"),
|
||||
Libraries = [],
|
||||
Created = DateTime.UtcNow
|
||||
UserPermissions = [],
|
||||
UserRoles = [],
|
||||
CreatedBy = Guid.NewGuid(),
|
||||
CreatedOnUtc = DateTime.UtcNow
|
||||
};
|
||||
|
||||
dbContext.Users.Add(user);
|
||||
|
||||
+6
-1
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.DataAccess.Common.Interceptors;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@@ -69,7 +70,11 @@ public class LuminaApiFactory : WebApplicationFactory<Program>, IDisposable
|
||||
if (descriptor is not null)
|
||||
services.Remove(descriptor);
|
||||
// add SQLite DbContext configuration
|
||||
services.AddDbContext<LuminaDbContext>(options => options.UseSqlite(_connection));
|
||||
services.AddDbContext<LuminaDbContext>((serviceProvider, options) =>
|
||||
{
|
||||
options.UseSqlite(_connection);
|
||||
options.AddInterceptors(serviceProvider.GetRequiredService<UpdateAuditableEntitiesInterceptor>());
|
||||
});
|
||||
// configure JWT authentication for testing
|
||||
services.PostConfigure<JwtBearerOptions>(JwtBearerDefaults.AuthenticationScheme, options =>
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user