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).
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:
For a client_credentials caller:
So no permission configuration can make this work for a client. UpdateRolesAsync fails the same way.
Steps to reproduce
What we expect from ABP
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.
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.
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.
[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
AbpAuditingOptionsand add a selector to itsAlwaysLogSelectorsproperty. (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.