Could not resolve type name: Sitecore.Services.GraphQL.Hosting.Security.Authorization.RoleAuthorizationFilter, Sitecore.Services.GraphQL

 Error:



Server Error in '/' Application.

Could not resolve type name: Sitecore.Services.GraphQL.Hosting.Security.Authorization.RoleAuthorizationFilter, Sitecore.Services.GraphQL (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.


Exception Details: System.Exception: Could not resolve type name: Sitecore.Services.GraphQL.Hosting.Security.Authorization.RoleAuthorizationFilter, Sitecore.Services.GraphQL (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).


Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:



[Exception: Could not resolve type name: Sitecore.Services.GraphQL.Hosting.Security.Authorization.RoleAuthorizationFilter, Sitecore.Services.GraphQL (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).]

   Sitecore.Diagnostics.Error.Raise(String error, String method) +133

   Sitecore.Configuration.DefaultFactory.CreateType(XmlNode configNode, String[] parameters, Boolean assert) +1009

   Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +89

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +163

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72

   Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +545

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +326

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72

   Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +703

   Sitecore.Configuration.DefaultFactory.CreateFromReference(XmlNode configNode, String[] parameters, Boolean assert) +170

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +116

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72

   Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +545

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +326

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, Boolean assert) +68

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode) +242

   Sitecore.Services.GraphQL.Hosting.Configuration.GraphQLEndpointManager.CreateEndpoint(XmlNode node) +40


[InvalidOperationException: Unable to create GraphQL endpoint due to a factory error. The faulted endpoint definition was <master type="Sitecore.Services.GraphQL.Hosting.GraphQLEndpoint, Sitecore.Services.GraphQL.NetFxHost" url="/sitecore/api/graph/items/master" resolve="true"><url>$(url)</url><enableSubscriptions>true</enableSubscriptions><!-- lock down the endpoint when deployed to content delivery --><schema hint="list:AddSchemaProvider"><!-- defaults are defined in Sitecore.Services.GraphQL.Content.config --><content ref="/sitecore/api/GraphQL/defaults/content/schemaProviders/systemContent" param1="master" /></schema><!-- Determines the security of the service. Defaults are defined in Sitecore.Services.GraphQL.config --><security ref="/sitecore/api/GraphQL/defaults/security/systemService" /><!-- Determines how performance is logged for the service. Defaults are defined in Sitecore.Services.GraphQL.config --><performance ref="/sitecore/api/GraphQL/defaults/performance/standard" /><!--

                            Cache improves the query performance by caching parsed queries.

                            It is also possible to implement query whitelisting by implementing an authoritative query cache;

                            WhitelistingGraphQLQueryCache is an example of this, capturing queries to files in open mode and allowing only captured queries in whitelist mode.

                        --><cache type="Sitecore.Services.GraphQL.Hosting.QueryTransformation.Caching.GraphQLQueryCache, Sitecore.Services.GraphQL.NetFxHost"><param desc="name">$(url)</param><param desc="maxSize">10MB</param></cache><!-- 

                            Extenders allow modifying schema types after they are created by a schema provider but before they are added to the final schema.

                            This is useful when you want to _extend_ a generated schema, for example to add external API

                            data onto the item API, or to add in custom internal data (e.g. custom layout data to power an app)

                            without having to directly modify a schema provider.

                        

                            Extenders must derive from SchemaExtender.

                        --><extenders hint="list:AddExtender" /></master>]

   Sitecore.Services.GraphQL.Hosting.Configuration.GraphQLEndpointManager.CreateEndpoint(XmlNode node) +166

   System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +241

   System.Linq.WhereEnumerableIterator`1.MoveNext() +127

   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +453

   System.Linq.Enumerable.ToList(IEnumerable`1 source) +69

   Sitecore.Services.GraphQL.Hosting.Configuration.GraphQLEndpointManager..ctor() +302

   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32

   Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) +407

   Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) +274

   Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) +221

   Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) +59

   Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument) +322

   Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) +42

   Microsoft.Extensions.DependencyInjection.ConstructorMatcher.CreateInstance(IServiceProvider provider) +132

   Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters) +485

   Sitecore.Configuration.DefaultFactory.CreateFromServiceProvider(XmlNode configNode, Boolean assert) +481


[ConfigurationException: Could not create object from service provider . Config XML: <processor type="Sitecore.Services.GraphQL.Hosting.Mvc.Pipelines.Initialize.InitializeRoutes, Sitecore.Services.GraphQL.NetFxHost" resolve="true" patch:source="Sitecore.Services.GraphQL.config" xmlns:patch="http://www.sitecore.net/xmlconfig/" />]

   Sitecore.Configuration.DefaultFactory.CreateFromServiceProvider(XmlNode configNode, Boolean assert) +641

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +138

   Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, Boolean assert) +68

   Sitecore.Pipelines.CorePipelineFactory.GetObjectFromType(XmlNode processorNode) +91

   Sitecore.Pipelines.CorePipelineFactory.GetProcessorObject(XmlNode processorNode) +138

   Sitecore.Pipelines.CoreProcessor.GetMethod(Object[] parameters) +136

   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +476

   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236

   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22

   Sitecore.Nexus.Web.HttpModule.Application_Start() +146

   Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +898

   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +584

   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168

   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277

   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369


[HttpException (0x80004005): Could not create object from service provider . Config XML: <processor type="Sitecore.Services.GraphQL.Hosting.Mvc.Pipelines.Initialize.InitializeRoutes, Sitecore.Services.GraphQL.NetFxHost" resolve="true" patch:source="Sitecore.Services.GraphQL.config" xmlns:patch="http://www.sitecore.net/xmlconfig/" />]

   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532

   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111

   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4330.0


Cause:

When I dotpeek the concerned dll, I couldn't find the method RoleAuthorizationFilter:


Note: Since I couldn't access the graphql endpoint , I tried uncommenting this section in the Sitecore.Services.GraphQL.config and then I was thrown the ysod when I accessed the graphql endpoint https://sc1011devsc.dev.local/sitecore/api/graph/items/master:


Based on the comments above this config section, I assume that if we want to implement custom authorization, then we need to implement the IAuthorizationFilter and write a custom method and patch it. So, guess RoleAuthorizationFilter method in this case is an example of such implementation.

Environment : Sitecore 10.1.1

SMS: 3.0.0

Comments