But I am getting the method mentioned in the documentation
1) UserService.IsUserValid ( using EPiServer.ContentApi.Core.Internal.UserService) => Am i refering wrong dll/namespace. 2) RoleService.IsValidRole
I have already added class CustomContentApiRoutingEventHandler
and
[InitializableModule] [ModuleDependency(typeof(ServiceContainerInitialization), typeof(ContentApiCmsInitialization))] public class ContentApiInitialization : IConfigurableModule { public void ConfigureContainer(ServiceConfigurationContext context) { context.Services.AddTransient<RoutingEventHandler, CustomContentApiRoutingEventHandler>(); context.Services.AddTransient<ContentApiRouteService, CustomContentApiRouteService>();
// set minimumRoles to empty to allow anonymous calls (for visitors to view site in view mode) context.Services.Configure<ContentApiConfiguration>(config => { config.Default() .SetMinimumRoles("ContentApiReaders") .SetRequiredRole("ContentApiReaders") .SetSiteDefinitionApiEnabled(true); });
Similar question here: https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2020/12/content-delivery-api---401-unauthorized/
Hello Guys,
I would like to implement the Content Delivery API with Azure AD B2C.
With following guideline I was suppose to start my implemenation
https://world.episerver.com/documentation/developer-guides/content-delivery-api/content-delivery-api-and-azure-ad/
But I am getting the method mentioned in the documentation
1) UserService.IsUserValid ( using EPiServer.ContentApi.Core.Internal.UserService) => Am i refering wrong dll/namespace.
2) RoleService.IsValidRole
I have already added class
CustomContentApiRoutingEventHandler
and
[InitializableModule]
[ModuleDependency(typeof(ServiceContainerInitialization), typeof(ContentApiCmsInitialization))]
public class ContentApiInitialization : IConfigurableModule
{
public void ConfigureContainer(ServiceConfigurationContext context)
{
context.Services.AddTransient<RoutingEventHandler, CustomContentApiRoutingEventHandler>();
context.Services.AddTransient<ContentApiRouteService, CustomContentApiRouteService>();
// set minimumRoles to empty to allow anonymous calls (for visitors to view site in view mode)
context.Services.Configure<ContentApiConfiguration>(config =>
{
config.Default()
.SetMinimumRoles("ContentApiReaders")
.SetRequiredRole("ContentApiReaders")
.SetSiteDefinitionApiEnabled(true);
});
context.Services.Configure<ContentApiSearchConfiguration>(config =>
{
config.Default()
.SetMaximumSearchResults(200)
.SetSearchCacheDuration(TimeSpan.FromMinutes(60));
});
}
public void Initialize(InitializationEngine context)
{
// Method intentionally left empty.
}
public void Uninitialize(InitializationEngine context)
{
// Method intentionally left empty.
}
}
Is there anything I need to add in Starup.cs. Or Do I need to implement the custom authorization?
Please give me head start..!
Any reply appreciate.
Dipak