Hi. I use auth server. I want to modify users table or roles entity (table , dto). And I want to add "LicienceId property" CurrentUser objet How can I do it.
- ABP Framework version: v7.1
- UI type: Angular
- DB provider: EF Core
- *Tiered Identity Server Separated (Angular)
7 Answer(s)
-
0
Hi,
You can use the object extensions system to add a new property to table: https://docs.abp.io/en/abp/latest/Module-Entity-Extensions
And I want to add "LicienceId property" CurrentUser objet
You can add
LicienceId
to claims: https://docs.abp.io/en/abp/latest/Modules/OpenIddict#updating-claims-in-access_token-and-id_token https://docs.abp.io/en/abp/latest/Authorization#claims-principal-factoryAnd add an extension method to currentuser:
public static string LicienceId(this ICurrentUser currentUser) { return currentUser.FindClaim(“LicienceId”)?.Value; }
-
0
Hello again,
First of all thanks for the answer, but when I use "object extensions system" to add a new property to the AbpUsers table, it adds this property as json data in the 'ExtraProperties' field, not as a new column. Is it possible to add it as a new column? Image: https://prnt.sc/WTi-Ib1DVvsV
Another question, we want to add LicienceId as a claim (CurrentUser) but the project does not see the requested AbpClaimsServiceOptions class. We can't see LicienceId among the claims. Note: the code https://prnt.sc/TtLhg2aFaPUF
Thanks for your help in advance
-
0
Hi,
First of all thanks for the answer, but when I use "object extensions system" to add a new property to the AbpUsers table, it adds this property as json data in the 'ExtraProperties' field, not as a new column. Is it possible to add it as a new column?
Of course, you can check this: https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities#entity-extensions-ef-core
Another question, we want to add LicienceId as a claim (CurrentUser) but the project does not see the requested AbpClaimsServiceOptions class. We can't see LicienceId among the claims.
It's working for me.
-
0
Alright. I created the field. How do I access Field? How do I get this value from the database when I log in? Is there a sign in handler? Isn't there a tidy document and example? In some documents it doesn't say where to add the code. I can't progress.
-
0
Hi,
See: https://docs.abp.io/en/abp/latest/Object-Extensions#getproperty
var identity = context.ClaimsPrincipal.Identities.FirstOrDefault(); var userId = identity?.FindUserId(); if (userId.HasValue) { var userManager = context.ServiceProvider.GetRequiredService<IdentityUserManager>(); var user = await userManager.GetByIdAsync(userId.Value); var licienceId = user.GetProperty<string>("LicienceId"); ...... }
-
0
Hi again,
I want to debug login process. I want to make a developing while entering, so How can I debug Account/Login module? Account/Login is a Abp Module and How can I develop login process as custom?
There is a CustomeSignInManager class in AuthServer project, Must I use it? İf there is a another way, I will be glad if you share with me.
Thanks,
-
0
Hi,
I think this is a new topic, please open a new ticket thanks.