Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Security/integrations/JSONREPOS/Groups/AdminGroup
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Changes": [],
"RecordId": null,
"DataEntityId": "AdminGroup",
"Name": "AdminGroup",
"Roles": [
"Administrator"
],
"RolesHash": "AQAAAAIAAYagAAAAEKys83RAExNqSZMakYMEvtaLHlF6kI3yWS9gDleKBO6s53gCSfoVkfXD39gPpl4Iiw==",
"Created": "2025-02-11T09:18:36.8940817+01:00",
"Modified": "2025-02-11T09:18:37.1615793+01:00"
}
26 changes: 26 additions & 0 deletions src/Security/integrations/JSONREPOS/Users/ADMIN
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"Group": "AdminGroup",
"GroupHash": "AQAAAAIAAYagAAAAEH459fL0GTOvnf5gp7UhOY+JhCPG3eEOZRUUm/6bNmuaIshufALUA26u1tX7DjC/1w==",
"CanUserChangePassword": false,
"RecordId": null,
"DataEntityId": "ADMIN",
"Created": "2025-02-11T09:18:38.5093794+01:00",
"Modified": "2025-02-11T09:18:49.4261626+01:00",
"EnableAutoLogOut": true,
"AutoLogOutTimeOutMinutes": 1,
"Id": "8f025957-3fee-43ab-ba2a-61df8cabe620",
"UserName": "admin",
"NormalizedUserName": "ADMIN",
"Email": null,
"NormalizedEmail": null,
"EmailConfirmed": false,
"PasswordHash": "AQAAAAIAAYagAAAAEEdaOAxx1qP2kSl7IzojBHsGUoK2I7rLguHf7DGXh1S6tuCujkL/NvpcHo7xX9oJvw==",
"SecurityStamp": "0cdd6524-fc36-4f9a-92eb-93c560194e79",
"ConcurrencyStamp": "f32ce433-7d12-4266-9c38-56218e426412",
"PhoneNumber": null,
"PhoneNumberConfirmed": false,
"TwoFactorEnabled": false,
"LockoutEnd": null,
"LockoutEnabled": false,
"AccessFailedCount": 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ IOptions<IdentityOptions> options
this.scopeFactory = scopeFactory;
this.userStore = userStore;
this.options = options;

Instances++;
}

internal static int Instances = 0;
UpperInvariantLookupNormalizer Normalizer = new UpperInvariantLookupNormalizer();

protected override TimeSpan RevalidationInterval => TimeSpan.FromSeconds(30);

Expand All @@ -62,7 +60,7 @@ protected override async Task<bool> ValidateAuthenticationStateAsync(
return false;
}

var user = await userStore.FindByNameAsync(userPrincipal.Identity.Name, cancellationToken);
var user = await userStore.FindByNameAsync(Normalizer.NormalizeName(userPrincipal.Identity.Name), cancellationToken);

if (user == null)
{
Expand Down Expand Up @@ -107,7 +105,7 @@ protected override async Task<bool> ValidateAuthenticationStateAsync(
}
catch (Exception ex)
{
throw new Exception("Revalidataion failed", ex);
throw new Exception("Revalidation failed", ex);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/security/integrations/axopen_blazor_auth_app/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@
//</SetupJson>
static (IRepository<User>, IRepository<Group>) SetUpMongo(string path = "Blazor")
{
var mongoUri = "mongodb://localhost:27017";

IRepository<User> userRepo = new MongoDbRepository<User>(new MongoDbRepositorySettings<User>(mongoUri, path, "Users"));
IRepository<Group> groupRepo = new MongoDbRepository<Group>(new MongoDbRepositorySettings<Group>(mongoUri, path, "Groups"));
var MongoDatabaseName = path;
var MongoConnectionString = "mongodb://localhost:27017";

IRepository<User> userRepo = AXOpen.Data.MongoDb.Repository.Factory<User>(new MongoDbRepositorySettings<User>(MongoConnectionString, MongoDatabaseName, "Users", idExpression: t => t.Id));
IRepository<Group> groupRepo = AXOpen.Data.MongoDb.Repository.Factory<Group>(new MongoDbRepositorySettings<Group>(MongoConnectionString, MongoDatabaseName, "Groups"));
return (userRepo, groupRepo);
}

Expand Down