TheCultOfRa
TheCultOfRa
CC#
Created by TheCultOfRa on 5/27/2023 in #help
❔ Services Not Working with DB Model
I have a db model
using Libraries.Shared.Models.DbModels.Authentication;
using Microsoft.AspNetCore.Identity;

namespace StoriedKingdom.Dungeon.Models.DbModels;

internal sealed class DiscordUser : AppUser<ulong>
{
internal DiscordUser(string userName, Guid auid) : base(userName, auid)
{
}
internal string Discriminator { get; set; } = string.Empty;

[ProtectedPersonalData] internal string Discord { get; set; } = string.Empty;

[ProtectedPersonalData] internal string NormalizedDiscord { get; set; } = string.Empty;

internal string? Avatar { get; set; }

internal bool? Verified { get; set; }
}
using Libraries.Shared.Models.DbModels.Authentication;
using Microsoft.AspNetCore.Identity;

namespace StoriedKingdom.Dungeon.Models.DbModels;

internal sealed class DiscordUser : AppUser<ulong>
{
internal DiscordUser(string userName, Guid auid) : base(userName, auid)
{
}
internal string Discriminator { get; set; } = string.Empty;

[ProtectedPersonalData] internal string Discord { get; set; } = string.Empty;

[ProtectedPersonalData] internal string NormalizedDiscord { get; set; } = string.Empty;

internal string? Avatar { get; set; }

internal bool? Verified { get; set; }
}
and some services that use it
addServices<TAppUser>(){
services.TryAddScoped<ISecurityStampValidator, SecurityStampValidator<TAppUser>>();

services.TryAddScoped<ITwoFactorSecurityStampValidator, TwoFactorSecurityStampValidator<TAppUser>>();
}
addServices<TAppUser>(){
services.TryAddScoped<ISecurityStampValidator, SecurityStampValidator<TAppUser>>();

services.TryAddScoped<ITwoFactorSecurityStampValidator, TwoFactorSecurityStampValidator<TAppUser>>();
}
however the service throws an error when using the model and I'm not sure why or what it means
Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.ISecurityStampValidator Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.SecurityStampValidator`1[StoriedKingdom.Dungeon.Models.DbModels.DiscordUser]'
Error while validating the service descriptor 'ServiceType: Microsoft.AspNetCore.Identity.ISecurityStampValidator Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Identity.SecurityStampValidator`1[StoriedKingdom.Dungeon.Models.DbModels.DiscordUser]'
15 replies
CC#
Created by TheCultOfRa on 5/27/2023 in #help
❔ How to get triggering authentication scheme name in custom cookie authentication event
I have a custom cookie authentication event where I want to inject the authentication handler into the constructor and then retrieve the name of the authentication scheme. I am unsure of how to do this since there's an abstraction that uses the AuthenticationScheme property but the interface does not.
3 replies
CC#
Created by TheCultOfRa on 5/27/2023 in #help
❔ Unable to resolve service for type 'NodaTime.IClock' while attempting to activate
Hello, I am using NodaTime in a service but when that service tries to register, it says it can't find IClock, but I can't figure out where in the documentation IClock is registered as a service.
4 replies
CC#
Created by TheCultOfRa on 10/4/2022 in #help
How does EFCore Migrations work for actual deployment?
So I understand that when locally developing I can do
Add-Migration
Update-Database
Add-Migration
Update-Database
and that I can even start the initial migration on startup via ApplicationDbContext.Database.Migrate but this doesn't seem encouraged in production. but when say deploying my app as a docker container, how do I exactly run those same commands? Do I do them as part of my dockerfile or dockercompose or something?
193 replies
CC#
Created by TheCultOfRa on 10/2/2022 in #help
Does anyone have any thorough resources or documentation on how to implement a custom Identity setup
I am trying to implement Identity on a project that does not already include it. I have found some resources to help but I cannot find any on setting up custom IdentityRoles except for this one https://www.youtube.com/watch?v=suq3cMv1V2o&list=PL82C6-O4XrHccS2fD8tdEF9UoO3VwKeGK&index=7. Does anyone have any other resources that could help me set this up?
11 replies
CC#
Created by TheCultOfRa on 8/15/2022 in #help
Index NavLink not working in NavMenu
I have two pages, Index and Register My navbar's SkullDugDungeon text should redirect to Index/Home While the Register NavLink works, the former does not.
72 replies