Ends in:
2 DAYS
5 HRS
6 MIN
15 SEC
Ends in:
2 D
5 H
6 M
15 S
Open Closed

Modifiy identity entities. #4823


User avatar
0
akifakinci created

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)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    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-factory

    And add an extension method to currentuser:

    public static string LicienceId(this ICurrentUser currentUser)
    {
        return currentUser.FindClaim(“LicienceId”)?.Value;
    }
    
  • User Avatar
    0
    fatihkaya created

    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

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    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.

  • User Avatar
    0
    akifakinci created

    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.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    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");
        ......
    }
    
  • User Avatar
    0
    fatihkaya created

    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,

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I think this is a new topic, please open a new ticket thanks.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35