Activities of "vipulbuoyancy"

hello

public class SocialSecurityNumberClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
{
    public async Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
    {
        var identity = context.ClaimsPrincipal.Identities.FirstOrDefault();
        var userId = identity?.FindUserId();
        if (userId.HasValue)
        {
            //var userService = context.ServiceProvider.GetRequiredService<IUserService>(); //Your custom service
            //var socialSecurityNumber = await userService.GetSocialSecurityNumberAsync(userId.Value);
            var socialSecurityNumber = "123456789";
            if (socialSecurityNumber != null)
            {
                identity.AddClaim(new Claim("SocialSecurityNumber", socialSecurityNumber));
            }
        }
    }
}

I add an IAbpClaimsPrincipalContributor in class. Working fine this code if I use the api from swagger, but when I call the api from angular project, I am unable to get the claim.

Hi Maliming,

Thanks for your reply,

I share my code

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AbpUserClaimsPrincipalFactory))]
public class UBXUserClaimsPrincipalFactory : AbpUserClaimsPrincipalFactory, ITransientDependency
{
        public UBXUserClaimsPrincipalFactory(UserManager<Volo.Abp.Identity.IdentityUser> userManager,                           RoleManager<Volo.Abp.Identity.IdentityRole> roleManager, IOptions<IdentityOptions> options,                        ICurrentPrincipalAccessor currentPrincipalAccessor, IAbpClaimsPrincipalFactory                                     abpClaimsPrincipalFactory) : base(userManager, roleManager, options, currentPrincipalAccessor,                     abpClaimsPrincipalFactory)
        {
        }
        [UnitOfWork]
        public override async Task<ClaimsPrincipal> CreateAsync(Volo.Abp.Identity.IdentityUser user)
        {
        var principal = await base.CreateAsync(user).ConfigureAwait(false);
        principal.Identities
                    .First()
                    .AddClaim(new Claim("ApiKey",  "712bfe60b83028da5XpkbpC6IgW0Fkagi0rWhay1nm7Ru6FzuYx5t6i2GX3PkoN7odDyNL463t5qZvM3WmMqUA67g2syy0rY3Trmhah5JXQXXYargIH4iGu3BObWIWwC"));
            return principal;
        }
}

public override void PreConfigureServices(ServiceConfigurationContext context)
        {
            PreConfigure<IdentityBuilder>(builder =>
            {
                builder.AddClaimsPrincipalFactory<UBXUserClaimsPrincipalFactory>();
            });
        }

Hi Maliming,

Thanks for your reply,

Right now I am using below code and which is working fine if I use the api from swagger, but when I call the api from angular project, I am unable to get the claim.

var identity = _currentPrincipalAccessor.Principal.Identities.FirstOrDefault(); identity.AddClaim(new Claim("VSPCApiKey", result));

Please help me if you have gone through the similar issue.

Thanks,

hello,

I try to generate after removing angular/.suite folder. Generate angular component successfully. But not display menu for new entity in angular UI. I faced get error in existing entity in angular UI :

core.mjs:6494 ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(OnAppUserModule)[ScrollbarHelper -> ScrollbarHelper -> ScrollbarHelper -> ScrollbarHelper]: NullInjectorError: No provider for ScrollbarHelper! NullInjectorError: R3InjectorError(OnAppUserModule)[ScrollbarHelper -> ScrollbarHelper -> ScrollbarHelper -> ScrollbarHelper]: NullInjectorError: No provider for ScrollbarHelper! at NullInjector.get (core.mjs:11157:1) at R3Injector.get (core.mjs:11324:1) at R3Injector.get (core.mjs:11324:1) at R3Injector.get (core.mjs:11324:1) at NgModuleRef.get (core.mjs:21888:1) at R3Injector.get (core.mjs:11324:1) at NgModuleRef.get (core.mjs:21888:1) at Object.get (core.mjs:21565:1) at lookupTokenUsingModuleInjector (core.mjs:3367:1) at getOrCreateInjectable (core.mjs:3479:1) at resolvePromise (zone.js:1213:1) at resolvePromise (zone.js:1167:1) at zone.js:1279:1 at ZoneDelegate.invokeTask (zone.js:406:1) at Object.onInvokeTask (core.mjs:25595:1) at ZoneDelegate.invokeTask (zone.js:405:1) at Zone.runTask (zone.js:178:1) at drainMicroTaskQueue (zone.js:582:1)

Thanks

Hello,

  • abp version

  • abp suite version

  • angular version

hello,

I shared my steps of Code generator in abp suite

step 1:

  • add new entity detail

step 2:

  • add properties

step 3:

  • add one-to-many navigation property

step 4:

  • click save and generate button.

Hello,

Code is generated for me. but angular UI component not generated

.abp\suite\logs

2022-06-28 17:45:56.964 +05:30 [INF] 1/10 - EntityGenerateCommand started... 2022-06-28 17:45:59.430 +05:30 [INF] 1/10 - EntityGenerateCommand completed. | Duration: 2465 ms. 2022-06-28 17:45:59.430 +05:30 [INF] 2/10 - RepositoryCommand started... 2022-06-28 17:45:59.926 +05:30 [INF] 2/10 - RepositoryCommand completed. | Duration: 493 ms. 2022-06-28 17:45:59.926 +05:30 [INF] 3/10 - ManagerCommand started... 2022-06-28 17:45:59.955 +05:30 [INF] 3/10 - ManagerCommand completed. | Duration: 29 ms. 2022-06-28 17:45:59.956 +05:30 [INF] 4/10 - AppServiceCommand started... 2022-06-28 17:46:00.135 +05:30 [INF] 4/10 - AppServiceCommand completed. | Duration: 179 ms. 2022-06-28 17:46:00.135 +05:30 [INF] 5/10 - ProxyControllerCommand started... 2022-06-28 17:46:00.155 +05:30 [INF] 5/10 - ProxyControllerCommand completed. | Duration: 19 ms. 2022-06-28 17:46:00.155 +05:30 [INF] 6/10 - PermissionCommand started... 2022-06-28 17:46:00.208 +05:30 [INF] 6/10 - PermissionCommand completed. | Duration: 52 ms. 2022-06-28 17:46:00.209 +05:30 [INF] 7/10 - ApplicationObjectMappingCommand started... 2022-06-28 17:46:00.250 +05:30 [INF] 7/10 - ApplicationObjectMappingCommand completed. | Duration: 40 ms. 2022-06-28 17:46:00.250 +05:30 [INF] 8/10 - UnitTestCommandCommand started... 2022-06-28 17:46:00.359 +05:30 [INF] 8/10 - UnitTestCommandCommand completed. | Duration: 109 ms. 2022-06-28 17:46:00.359 +05:30 [INF] 9/10 - AngularUiGenerateWithSchematicsCommand started... 2022-06-28 17:46:00.371 +05:30 [INF] Running the Angular Schematics command: npx "D:/Projects/UBX/angular/.suite/schematics/node_modules/.bin/ng" g ".suite/schematics/collection.json:entity" app-pro UBX_Client_Angular "D:/Projects/UBX/aspnet-core/.suite/entities/VSPCUser.json" 2022-06-28 17:46:05.374 +05:30 [INF] Angular Schematics command failed. An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID See "C:\Users\BUOYAN~1\AppData\Local\Temp\ng-7quWKa\angular-errors.log" for further details.

2022-06-28 17:46:05.380 +05:30 [INF] 9/10 - AngularUiGenerateWithSchematicsCommand completed. | Duration: 5020 ms. 2022-06-28 17:46:05.380 +05:30 [INF] 10/10 - DbMigrationCommand started... 2022-06-28 17:46:05.381 +05:30 [INF] Adding new migration... 2022-06-28 17:46:05.381 +05:30 [INF] cd /d "D:\Projects\UBX\aspnet-core\src\UBX_Client_Angular.EntityFrameworkCore" && dotnet ef migrations add Added_VSPCUser --startup-project ../UBX_Client_Angular.HttpApi.Host --output-dir Migrations --context UBX_Client_AngularDbContext 2022-06-28 17:48:04.063 +05:30 [ERR] Build started... Build failed. Use dotnet build to see the errors.

Local\Temp\ angular-error log

[error] Error: NOT SUPPORTED: keyword "id", use "$id" for schema ID at Object.code (D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\vocabularies\core\id.js:6:15) at keywordCode (D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\compile\validate\index.js:454:13) at D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\compile\validate\index.js:222:17 at CodeGen.code (D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:439:13) at CodeGen.block (D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:568:18) at iterateKeywords (D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\compile\validate\index.js:219:9) at groupKeywords (D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\compile\validate\index.js:208:13) at D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\compile\validate\index.js:192:13 at CodeGen.code (D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:439:13) at CodeGen.block (D:\Projects\UBX\angular\node_modules@angular\cli\node_modules\ajv\dist\compile\codegen\index.js:568:18)

Showing 51 to 57 of 57 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 08, 2025, 08:24
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.