Open Closed

Admin --> Identity Management --> Users --> Claims : Error when click on "Add claim" #7640


User avatar
0
dhill created

Admin --> Identity Management --> Users --> Claims : Error when click on "Add claim"

Please see below screenshot.

  • ABP Framework version: v8.2.1
  • UI Type: Blazor Web App
  • Database System: EF Core
  • Exception message and full stack trace:
  • Steps to reproduce the issue:


6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I can't reproduce. Please share the logs of the backend.

    Thanks.

  • User Avatar
    0
    dhill created
    2024-08-06 09:41:46.301 -05:00 [INF] Executing endpoint 'Volo.Abp.Identity.IdentityUserController.GetExternalLoginProvidersAsync (Volo.Abp.Identity.Pro.HttpApi)'
    2024-08-06 09:41:46.322 -05:00 [INF] Route matched with {area = "identity", controller = "User", action = "GetExternalLoginProviders", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[System.Collections.Generic.List`1[Volo.Abp.Identity.ExternalLoginProviderDto]] GetExternalLoginProvidersAsync() on controller Volo.Abp.Identity.IdentityUserController (Volo.Abp.Identity.Pro.HttpApi).
    2024-08-06 09:41:46.327 -05:00 [INF] Route matched with {area = "identity", controller = "User", action = "GetList", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Application.Dtos.PagedResultDto`1[Volo.Abp.Identity.IdentityUserDto]] GetListAsync(Volo.Abp.Identity.GetIdentityUsersInput) on controller Volo.Abp.Identity.IdentityUserController (Volo.Abp.Identity.Pro.HttpApi).
    2024-08-06 09:41:46.386 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users.Import
    2024-08-06 09:41:46.386 -05:00 [DBG] Found in the cache: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users.Import
    2024-08-06 09:41:46.392 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:AbpIdentity.Users.Import
    2024-08-06 09:41:46.392 -05:00 [DBG] Found in the cache: pn:R,pk:admin,n:AbpIdentity.Users.Import
    2024-08-06 09:41:46.392 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users
    2024-08-06 09:41:46.392 -05:00 [DBG] Found in the cache: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users
    2024-08-06 09:41:46.392 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:AbpIdentity.Users
    2024-08-06 09:41:46.393 -05:00 [DBG] Found in the cache: pn:R,pk:admin,n:AbpIdentity.Users
    2024-08-06 09:41:46.418 -05:00 [WRN] Ldap login feature is not enabled!
    2024-08-06 09:41:46.429 -05:00 [WRN] OAuth login feature is not enabled!
    2024-08-06 09:41:46.429 -05:00 [INF] Executing ObjectResult, writing value of type 'System.Collections.Generic.List`1[[Volo.Abp.Identity.ExternalLoginProviderDto, Volo.Abp.Identity.Pro.Application.Contracts, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]]'.
    2024-08-06 09:41:46.445 -05:00 [INF] Executed action Volo.Abp.Identity.IdentityUserController.GetExternalLoginProvidersAsync (Volo.Abp.Identity.Pro.HttpApi) in 123.0753ms
    2024-08-06 09:41:46.448 -05:00 [INF] Executed endpoint 'Volo.Abp.Identity.IdentityUserController.GetExternalLoginProvidersAsync (Volo.Abp.Identity.Pro.HttpApi)'
    2024-08-06 09:41:46.448 -05:00 [INF] Request finished HTTP/2 GET https://localhost:44399/api/identity/users/external-login-Providers?api-version=1.0 - 200 null application/json; charset=utf-8 195.9646ms
    2024-08-06 09:41:46.618 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users
    2024-08-06 09:41:46.618 -05:00 [DBG] Found in the cache: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users
    2024-08-06 09:41:46.618 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:AbpIdentity.Users
    2024-08-06 09:41:46.618 -05:00 [DBG] Found in the cache: pn:R,pk:admin,n:AbpIdentity.Users
    2024-08-06 09:41:50.752 -05:00 [DBG] Added 0 entity changes to the current audit log
    2024-08-06 09:41:50.752 -05:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Application.Dtos.ListResultDto`1[[Volo.Abp.Identity.IdentityRoleDto, Volo.Abp.Identity.Pro.Application.Contracts, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]]'.
    2024-08-06 09:41:50.758 -05:00 [INF] Executed action Volo.Abp.Identity.IdentityUserController.GetAssignableRolesAsync (Volo.Abp.Identity.Pro.HttpApi) in 4612.9616ms
    2024-08-06 09:41:50.758 -05:00 [INF] Executed endpoint 'Volo.Abp.Identity.IdentityUserController.GetAssignableRolesAsync (Volo.Abp.Identity.Pro.HttpApi)'
    2024-08-06 09:41:50.758 -05:00 [INF] Request finished HTTP/2 GET https://localhost:44399/api/identity/users/assignable-roles?api-version=1.0 - 200 null application/json; charset=utf-8 4635.0978ms
    2024-08-06 09:41:51.056 -05:00 [DBG] Added 0 entity changes to the current audit log
    2024-08-06 09:41:51.057 -05:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Application.Dtos.PagedResultDto`1[[Volo.Abp.Identity.IdentityUserDto, Volo.Abp.Identity.Pro.Application.Contracts, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]]'.
    2024-08-06 09:41:51.082 -05:00 [INF] Executed action Volo.Abp.Identity.IdentityUserController.GetListAsync (Volo.Abp.Identity.Pro.HttpApi) in 4755.2186ms
    2024-08-06 09:41:51.082 -05:00 [INF] Executed endpoint 'Volo.Abp.Identity.IdentityUserController.GetListAsync (Volo.Abp.Identity.Pro.HttpApi)'
    2024-08-06 09:41:51.083 -05:00 [INF] Request finished HTTP/2 GET https://localhost:44399/api/identity/users?Sorting=&SkipCount=0&MaxResultCount=10&ExtraProperties=Volo.Abp.Data.ExtraPropertyDictionary&api-version=1.0 - 200 null application/json; charset=utf-8 4830.7716ms
    2024-08-06 09:41:55.573 -05:00 [INF] Request starting HTTP/2 GET https://localhost:44399/api/identity/users/all-claim-types?api-version=1.0 - null null
    2024-08-06 09:41:55.574 -05:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri.
    2024-08-06 09:41:55.574 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri.
    2024-08-06 09:41:55.574 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType.
    2024-08-06 09:41:55.574 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType.
    2024-08-06 09:41:55.575 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateTransportSecurityRequirement.
    2024-08-06 09:41:55.575 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader.
    2024-08-06 09:41:55.607 -05:00 [DBG] Get dynamic claims cache for user: d3a58a5b-0605-02eb-49f4-3a13b6093bbf
    2024-08-06 09:41:55.610 -05:00 [INF] Executing endpoint 'Volo.Abp.Identity.IdentityUserController.GetAllClaimTypesAsync (Volo.Abp.Identity.Pro.HttpApi)'
    2024-08-06 09:41:55.615 -05:00 [INF] Route matched with {area = "identity", controller = "User", action = "GetAllClaimTypes", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[System.Collections.Generic.List`1[Volo.Abp.Identity.ClaimTypeDto]] GetAllClaimTypesAsync() on controller Volo.Abp.Identity.IdentityUserController (Volo.Abp.Identity.Pro.HttpApi).
    2024-08-06 09:41:55.625 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users
    2024-08-06 09:41:55.625 -05:00 [DBG] Found in the cache: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users
    2024-08-06 09:41:55.626 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:AbpIdentity.Users
    2024-08-06 09:41:55.626 -05:00 [DBG] Found in the cache: pn:R,pk:admin,n:AbpIdentity.Users
    2024-08-06 09:41:55.709 -05:00 [DBG] Added 0 entity changes to the current audit log
    2024-08-06 09:41:55.709 -05:00 [INF] Executing ObjectResult, writing value of type 'System.Collections.Generic.List`1[[Volo.Abp.Identity.ClaimTypeDto, Volo.Abp.Identity.Pro.Application.Contracts, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]]'.
    2024-08-06 09:41:55.729 -05:00 [INF] Executed action Volo.Abp.Identity.IdentityUserController.GetAllClaimTypesAsync (Volo.Abp.Identity.Pro.HttpApi) in 113.798ms
    2024-08-06 09:41:55.729 -05:00 [INF] Executed endpoint 'Volo.Abp.Identity.IdentityUserController.GetAllClaimTypesAsync (Volo.Abp.Identity.Pro.HttpApi)'
    2024-08-06 09:41:55.730 -05:00 [INF] Request finished HTTP/2 GET https://localhost:44399/api/identity/users/all-claim-types?api-version=1.0 - 200 null application/json; charset=utf-8 157.4328ms
    2024-08-06 09:41:55.764 -05:00 [INF] Request starting HTTP/2 GET https://localhost:44399/api/identity/users/6a27ac13-fb4a-3de3-dd14-3a13f2c9354c/claims?api-version=1.0 - null null
    2024-08-06 09:41:55.765 -05:00 [DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri.
    2024-08-06 09:41:55.765 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri.
    2024-08-06 09:41:55.765 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType.
    2024-08-06 09:41:55.765 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType.
    2024-08-06 09:41:55.765 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateTransportSecurityRequirement.
    2024-08-06 09:41:55.765 -05:00 [DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader.
    2024-08-06 09:41:55.792 -05:00 [DBG] Get dynamic claims cache for user: d3a58a5b-0605-02eb-49f4-3a13b6093bbf
    2024-08-06 09:41:55.799 -05:00 [INF] Executing endpoint 'Volo.Abp.Identity.IdentityUserController.GetClaimsAsync (Volo.Abp.Identity.Pro.HttpApi)'
    2024-08-06 09:41:55.805 -05:00 [INF] Route matched with {area = "identity", controller = "User", action = "GetClaims", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[System.Collections.Generic.List`1[Volo.Abp.Identity.IdentityUserClaimDto]] GetClaimsAsync(System.Guid) on controller Volo.Abp.Identity.IdentityUserController (Volo.Abp.Identity.Pro.HttpApi).
    2024-08-06 09:41:55.816 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users
    2024-08-06 09:41:55.816 -05:00 [DBG] Found in the cache: pn:U,pk:d3a58a5b-0605-02eb-49f4-3a13b6093bbf,n:AbpIdentity.Users
    2024-08-06 09:41:55.816 -05:00 [DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:AbpIdentity.Users
    2024-08-06 09:41:55.816 -05:00 [DBG] Found in the cache: pn:R,pk:admin,n:AbpIdentity.Users
    2024-08-06 09:41:55.876 -05:00 [DBG] Added 0 entity changes to the current audit log
    2024-08-06 09:41:55.876 -05:00 [INF] Executing ObjectResult, writing value of type 'System.Collections.Generic.List`1[[Volo.Abp.Identity.IdentityUserClaimDto, Volo.Abp.Identity.Pro.Application.Contracts, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]]'.
    2024-08-06 09:41:55.877 -05:00 [INF] Executed action Volo.Abp.Identity.IdentityUserController.GetClaimsAsync (Volo.Abp.Identity.Pro.HttpApi) in 72.4425ms
    2024-08-06 09:41:55.877 -05:00 [INF] Executed endpoint 'Volo.Abp.Identity.IdentityUserController.GetClaimsAsync (Volo.Abp.Identity.Pro.HttpApi)'
    2024-08-06 09:41:55.878 -05:00 [INF] Request finished HTTP/2 GET https://localhost:44399/api/identity/users/6a27ac13-fb4a-3de3-dd14-3a13f2c9354c/claims?api-version=1.0 - 200 null application/json; charset=utf-8 114.4871ms
    
  • User Avatar
    0
    dhill created

    @ invoke-js.ts:176 blazor.web.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Value cannot be null. (Parameter 'input') System.ArgumentNullException: Value cannot be null. (Parameter 'input') at System.Text.RegularExpressions.ThrowHelper.ThrowArgumentNullException(ExceptionArgument arg) at System.Text.RegularExpressions.Regex.IsMatch(String input) at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern) at Volo.Abp.Identity.Pro.Blazor.Pages.Identity.UserManagement.AddClaimAsync() at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Blazorise.Button.ClickHandler(MouseEventArgs eventArgs) at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please try this.

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(UserManagement))]
    public class MyUserManagement : UserManagement
    {
        protected async override Task AddClaimAsync()
        {
            var claim = ClaimsModel.AllClaims.FirstOrDefault(c => c.Name == SelectedClaimType);
            if (claim == null)
            {
                return;
            }
    
            if (claim.Required && (claim.ValueType == IdentityClaimValueType.String && string.IsNullOrWhiteSpace(SelectedClaimValueText)))
            {
                await Message.Info(L["ClaimValueCanNotBeBlank"]);
                return;
            }
    
            if (SelectedClaimValueText.IsNullOrWhiteSpace())
            {
                await Message.Info(L["ClaimValueIsInvalid", claim.Name]);
                return;
            }
    
            if(!SelectedClaimValueText.IsNullOrWhiteSpace() && !claim.Regex.IsNullOrWhiteSpace() && !Regex.IsMatch(SelectedClaimValueText, claim.Regex))
            {
                await Message.Info(L["ClaimValueIsInvalid", claim.Name]);
                return;
            }
    
            ClaimsModel.OwnedClaims.Add(new IdentityUserClaimViewModel
            {
                ClaimType = SelectedClaimType,
                ClaimValueText = SelectedClaimValueText,
                ClaimValueNumeric = SelectedClaimValueNumeric,
                ClaimValueDate = SelectedClaimValueDate,
                ClaimValueBool = SelectedClaimValueBool
            });
        }
    }
    
  • User Avatar
    0
    dhill created

    That worked. Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11