Activities of "ElifKaya"

thanks a lot

We have a .NET console application that synchronizes users and roles from an external system into ABP. It talks to the HTTP API only through ABP's dynamic HTTP client proxies (AbpIdentityHttpApiClientModule, AbpHttpClientIdentityModelModule).

  • It authenticates with the client_credentials grant, using a confidential OpenIddict application with a client id and client secret. No user is involved.
  • The application is created by our data seeder with the client_credentials grant type only.
  • The client is granted the required permissions directly (permission provider "C"), e.g.: AbpIdentity.Users, AbpIdentity.Users.Create, AbpIdentity.Users.Update, AbpIdentity.Users.Update.ManageRoles, AbpIdentity.Roles, AbpIdentity.Roles.Create, ...
  • Since it is a client and not a user, it has no roles. ABP doesn't support assigning roles to OpenIddict applications.

appsettings of the console app: "IdentityClients": { "Default": { "GrantType": "client_credentials", "ClientId": "MOD_Synch_App", "ClientSecret": "***", "Authority": "https://<auth-server>", "Scope": "PSSX" } }

The app calls IIdentityUserAppService.CreateAsync(new IdentityUserCreateDto { ..., RoleNames = new[] { "SomeRole" } }).

Problem

This worked with 9.1.0. After upgrading to 10.6.0, CreateAsync fails with HTTP 500 whenever RoleNames is set:

System.InvalidOperationException: Nullable object must have a value. at Volo.Abp.Identity.IdentityUserAppService.FilterRolesByCurrentUserAsync(IdentityUser user, String[] inputRoleNames) at Volo.Abp.Identity.IdentityUserAppService.UpdateUserByInput(IdentityUser user, IdentityUserCreateOrUpdateDtoBase input) at Volo.Abp.Identity.IdentityUserAppService.CreateAsync(IdentityUserCreateDto input)

The permission check passes, otherwise we would get a 403. The failure happens in the new role filtering logic. Our understanding of it:

  • If the current user is in the admin role, the requested roles are assigned as is.
  • Otherwise, it loads the current user via CurrentUser.GetId() to restrict the roles to the ones the caller has.

For a client_credentials caller:

  • CurrentUser.IsInRole("admin") is always false, because a client has no roles.
  • CurrentUser.Id is null, so CurrentUser.GetId() throws.

So no permission configuration can make this work for a client. UpdateRolesAsync fails the same way.

Steps to reproduce

  1. Create a confidential OpenIddict application with the client_credentials grant.
  2. Grant it AbpIdentity.Users.Create and AbpIdentity.Users.Update.ManageRoles.
  3. Get a token with client_credentials and call POST /api/identity/users with a non-empty roleNames.
  4. Result: 500 "Nullable object must have a value."

What we expect from ABP

  1. Confirmation whether this is a bug: the new logic doesn't seem to handle callers without a user (client_credentials).
  2. A fix where machine-to-machine clients with the required permissions (e.g. ManageRoles) can assign roles as in 9.x, or at least get a proper authorization error instead of an InvalidOperationException.
  3. The recommended way to assign roles from a client_credentials client in 10.x until a fix is released.
  4. Feedback on our workaround. In our custom IdentityUserAppService (which already replaces the default one), we override:

protected override async Task<string[]> FilterRolesByCurrentUserAsync(IdentityUser user, string[] inputRoleNames) { if (CurrentUser.Id == null && <current client is our sync client>) { return inputRoleNames; }

return await base.FilterRolesByCurrentUserAsync(user, inputRoleNames);

}

Is this safe and supported?

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage.

Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Thank you so much !

[maliming] said: Hi

You can share the test project , I will add the code for interception.

Thanks.

I send test project, thank you so much

[maliming] said: hi

Can you share a demo project with your code?

I will check it.

liming.ma@volosoft.com

Thanks

I have already Attribute.cs and Interceptor.cs. I want to continue with my custom solution. But, how should I configure my interceptor in ConfigureServices. Or, If you have any example to manage an interceptor for an application service, could you please send me the example link?

.

[AI-Bot] said:

  • The [InterceptedBy] attribute is not available in ABP 9.1.0, and AbpCastleProxyOptions has been removed in recent ABP versions.
  • The recommended way to apply a custom interceptor to specific services or methods in ABP 9.1.0 is to register your interceptor globally and, inside your interceptor logic, check for the presence of your custom attribute (as you are already doing). This allows you to conditionally execute logic only for methods or classes marked with your attribute.
  • Conditional registration of interceptors based on a custom attribute is not natively supported in ABP 9.1.0. Instead, you must use the pattern you have implemented: register the interceptor for all services, and inside the interceptor, check for your custom attribute before executing your logic.

Your current approach—checking for the attribute within the interceptor—is the correct and supported method in ABP 9.1.0.

No verified source available for this specific query.


This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

I'm using ABP Framework version 9.1.0 and I have created:

A custom attribute (e.g., [CheckBaseModelProviderAttribute]) A class implementing IInterceptor (e.g., CheckBaseModelProviderInterceptor) I apply the attribute to some application services, and I can confirm that the attribute is being hit (debug point works). However, the interceptor itself is not being triggered.

My goal is to ensure that whenever a service or method is decorated with [CheckBaseModelProviderAttribute], the CheckBaseModelProviderInterceptor logic runs.

My questions:

How should I register this interceptor in MyProjectModule.cs (inside ConfigureServices) so that it works with the custom attribute? Is there a way in ABP 9.1.0 to conditionally apply an interceptor based on a custom attribute? Is AbpCastleProxyOptions available in this version, or is there an alternative way to wire up the interceptor? Thanks in advance for your help!

Hi,

I'm using ABP Framework version 9.1.0 and I want to apply method-level interception using a custom IInterceptor implementation. Ideally, I would like to use either:

The [InterceptedBy] attribute (if available), or A custom attribute that I can define and use to selectively apply interceptors to specific services or methods. However, I couldn't find the InterceptedBy attribute in this version, and AbpCastleProxyOptions also seems to be missing.

My questions:

Is [InterceptedBy] supported in ABP 9.1.0? If so, which package provides it? If not, what is the recommended way to apply a custom interceptor to only specific services or methods? Can I register an interceptor conditionally based on a custom attribute in this version? Thanks in advance for your help!

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage.

Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi,

We have a modular architecture with three separate modules: PPM, MEX, and OEX.

PPM consumes both MEX and OEX internally. In our final monolithic solution, we consume all three modules together. Some of MEX's endpoints and permissions are exposed through PPM. Now, we want to make PPM behave differently depending on whether MEX or OEX is enabled. To achieve this, we are considering using Global Features inside PPM to conditionally enable or disable parts of the module (e.g., permissions, endpoints, services) related to MEX and OEX.

Is this a recommended and clean approach in ABP Framework? Or would you suggest a different pattern for managing such conditional module behavior without tightly coupling the modules?

Thanks in advance!

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage.

Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • Exception message and full stack trace:
  • Steps to reproduce the issue:

[EngincanV] said: Hi, ABP does not check if the URL is empty or not, it's a nullable field, because in your code you may want to write audit logs for any internal process call. For example, you may want to audit log your event handlers and for these cases, the URL should be emptyl and you can also think similar scenerios where HttpContext is not in the place.

If you don't want to log if the URL is empty, then you can create audit log contributor or configure AbpAuditingOptions and add a selector to its AlwaysLogSelectors property. (See https://abp.io/docs/latest/framework/infrastructure/audit-logging#abpauditingoptions)

Thanks

Audit log data is being recorded as null in the database. Shouldn't this be prevented at the domain level by ABP? It seems that data is being stored this way through events. Can you fix this issue?

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage.

Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • Exception message and full stack trace:
  • Steps to reproduce the issue:
Showing 1 to 10 of 120 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 v11.1.0-preview. Updated on December 02, 2026, 11:33
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.