You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 2, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 2, 2026. It is now read-only.
In Startup.ConfigureServices of Admin and AdminApi projects there are lots of Type parameters (Admin, for example).
It's very difficult to understand, which parameter user should to change if he want to change something.
I suppose to create a builder to split this method. It'll look something like this:
In configuration we start from default values, so user can skip some blocks like ConfigureKeys.
I start to making this, but I have some question for now (may be I'll add some more later):
In Skoruba.IdentityServer4.Admin.EntityFramework.Identity.Repositories.IdentityRepository you have TUserKey, TRoleKey, and TKey parameters (src). TUserKey and TRoleKey are never used except these 2 methods: ConvertUserKeyFromString and ConvertRoleKeyFromString
All other parameters are depend from TKey (TUser : IdentityUser<TKey>, for example).
Later you use UserManager<IdentityUser<TKey>>.Users.AnyAsync(x => x.Id.Equals(_instance of TUserKey_));here.
If TKey and TUserKey will be a different types, this code will fall, isn't it?
You are right, this configuration is maybe too complex.
Yes, TKey and TUserKey must be same type. I like your approach, we can rewrite this, if you can send some PR, it would be great.
This is great question, I would prefer separate keys for User and Role, maybe we can remove TKey at all and keep only TUserKey and TRoleKey. What do you think?
Yes, it's better to remove TKey, but what about the keys in TUserClaim, TUserRole, TUserLogin, TRoleClaim and TUserToken? Which keys they should to use? I didn't work with ASP.Net Identity so deep before, so I know nothing about these keys.
These objects are connected with TUserKey and TRoleKey. For example: TUserClaim is object which uses TUserKey. You are not able to specify primary key for TUserClaim but you can specify primary key for User which is used in TUserClaim. Does it make sense for you?
Yes, I think, it does. But after looking to sources of Identity there are some questions. IdentityUserClaim<TUserKey>, IdentityUserLogin<TUserKey>, IdentityRoleClaim<TRoleKey> and IdentityUserToken<TUserKey> are contains only one of [TUserKey UserId, TRoleKey RoleId].
But IdentityUserClaim<TKey> contains both TKey RoleId and TKey UserId, which means that TUserKey and TRoleKey are the same type TKey, so we're not able to split TKey to two different types. Am i right?
I was looking at this issue and associated PR and me too find that configuration is a bit complex and definitively there is TRoleKey and TUserKey type params too much.
I find PR maybe a bit too big so maybe it's possible to split it in two, one for TRoleKey and TUserKey removal and another for simplified configuration?
Activity
skoruba commentedon Dec 3, 2019
You are right, this configuration is maybe too complex.
Yes,
TKeyandTUserKeymust be same type. I like your approach, we can rewrite this, if you can send some PR, it would be great.fatalistt commentedon Dec 3, 2019
Yes, I will make a PR later when i finished it.
If
TKeyandTUserKey(TRoleKey) must be the same type, why do we needTUserKey(TRoleKey) ever?skoruba commentedon Dec 3, 2019
This is great question, I would prefer separate keys for User and Role, maybe we can remove
TKeyat all and keep onlyTUserKeyandTRoleKey. What do you think?fatalistt commentedon Dec 3, 2019
Yes, it's better to remove
TKey, but what about the keys inTUserClaim,TUserRole,TUserLogin,TRoleClaimandTUserToken? Which keys they should to use? I didn't work with ASP.Net Identity so deep before, so I know nothing about these keys.skoruba commentedon Dec 3, 2019
These objects are connected with
TUserKeyandTRoleKey. For example:TUserClaimis object which usesTUserKey. You are not able to specify primary key forTUserClaimbut you can specify primary key for User which is used inTUserClaim. Does it make sense for you?fatalistt commentedon Dec 3, 2019
Yes, I think, it does. But after looking to sources of Identity there are some questions.
IdentityUserClaim<TUserKey>,IdentityUserLogin<TUserKey>,IdentityRoleClaim<TRoleKey>andIdentityUserToken<TUserKey>are contains only one of [TUserKey UserId,TRoleKey RoleId].But
IdentityUserClaim<TKey>contains bothTKey RoleIdandTKey UserId, which means thatTUserKeyandTRoleKeyare the same typeTKey, so we're not able to splitTKeyto two different types. Am i right?skoruba commentedon Dec 3, 2019
Can you send me which part do you mean?
fatalistt commentedon Dec 4, 2019
Yes, of course.
IdentityUserRole from AspNetCore.
Constraint for TUserRole in your code.
skoruba commentedon Dec 4, 2019
You are right, thanks for this point. We should use only one key - TKey, becuase of this limitation.
b0 commentedon Feb 16, 2020
Hi @skoruba and @fatalistt,
I was looking at this issue and associated PR and me too find that configuration is a bit complex and definitively there is TRoleKey and TUserKey type params too much.
I find PR maybe a bit too big so maybe it's possible to split it in two, one for TRoleKey and TUserKey removal and another for simplified configuration?
What do you think?
Thank you
skoruba commentedon Feb 16, 2020
Hi @b0 I definitely agree with you, I am happy for this PR, but it is too complex - splitting would be perfect.