{"record":{"id":"8a91331dd1745392","repo":"abpframework/abp","slug":"volo-authorization-010005","errorCode":"Volo.Authorization:010005","errorMessage":"Authorization failed! Given requirements has not granted for given resource: {ResourceName}","messagePattern":"Authorization failed! Given requirements has not granted for given resource: (.+?)","errorType":"exception","errorClass":"AbpAuthorizationException","httpStatus":403,"severity":"error","filePath":"framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs","lineNumber":178,"sourceCode":"    public static async Task CheckAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy)\n    {\n        if (!await authorizationService.IsGrantedAsync(policy))\n        {\n            throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGranted);\n        }\n    }\n\n    /// <summary>\n    /// Checks if CurrentPrincipal meets a specific authorization policy against the specified resource, throwing an <see cref=\"AbpAuthorizationException\"/> if not.\n    /// </summary>\n    /// <param name=\"authorizationService\">The <see cref=\"IAuthorizationService\"/> providing authorization.</param>\n    /// <param name=\"resource\">The resource to evaluate the policy against.</param>\n    /// <param name=\"requirements\">The requirements to evaluate the policy against.</param>\n    public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements)\n    {\n        if (!await authorizationService.IsGrantedAsync(resource, requirements))\n        {\n            throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenRequirementsHasNotGrantedForGivenResource)\n                .WithData(\"ResourceName\", resource);\n        }\n    }\n\n    /// <summary>\n    /// Checks if CurrentPrincipal meets a specific authorization policy against the specified resource, throwing an <see cref=\"AbpAuthorizationException\"/> if not.\n    /// </summary>\n    /// <param name=\"authorizationService\">The <see cref=\"IAuthorizationService\"/> providing authorization.</param>\n    /// <param name=\"resource\">The resource to evaluate the policy against.</param>\n    /// <param name=\"policyName\">The name of the policy to evaluate.</param>\n    public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, string policyName)\n    {\n        if (!await authorizationService.IsGrantedAsync(resource, policyName))\n        {\n            throw new AbpAuthorizationException(code: AbpAuthorizationErrorCodes.GivenPolicyHasNotGrantedForGivenResource)\n                .WithData(\"ResourceName\", resource);\n        }\n    }","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs#L160-L196","documentation":"Thrown by CheckAsync(this IAuthorizationService, object resource, IEnumerable<IAuthorizationRequirement> requirements) when IsGrantedAsync(resource, requirements) is false. Error code Volo.Authorization:010005 (GivenRequirementsHasNotGrantedForGivenResource), ResourceName attached as data. This is the multi-requirement, resource-scoped variant.","triggerScenarios":"Calling authorizationService.CheckAsync(resource, new[] { req1, req2 }) where at least one requirement, evaluated against the resource, does not succeed for the current principal.","commonSituations":"One of several requirements fails for the resource (e.g. ownership ok but status check fails); a requirement in the list has no matching handler; resource is null/wrong-typed for some handler; mixing requirement types with incompatible handlers.","solutions":["Identify which requirement in the enumerable is not being Succeeded (test each individually).","Confirm a resource-aware handler is registered for every requirement type passed.","Ensure the resource instance is the correct type and passes each handler's logic.","Reduce the requirement set to the minimum needed so unrelated failures don't block access."],"exampleFix":"// before\nawait AuthorizationService.CheckAsync(doc, new[] { OwnsReq, IsActiveReq }); // 010005\n// after: verify each requirement passes; here doc was inactive -> activate or allow","handlingStrategy":"validation","validationCode":"if (!await authorizationService.IsGrantedAsync(resource, requirements))\n{\n    // return 403 for this resource/requirements set\n}","typeGuard":"null","tryCatchPattern":"try { await authorizationService.CheckAsync(resource, requirements); }\ncatch (AbpAuthorizationException ex) when (ex.Code == \"Volo.Authorization:010005\")\n{ /* handle forbidden; check each requirement individually */ }","preventionTips":["Register resource-aware handlers for every requirement type you pass.","Test each requirement separately to find which one denies.","Keep the requirement set minimal to avoid unrelated denials.","Ensure the resource instance type matches each handler."],"tags":["authorization","abp","security","resource","requirements"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}