Yes thank you that was the missing module.
We are using the Single Layer Application Template.
This is currently in my module:
[DependsOn(
// ABP Framework packages
typeof(AbpAspNetCoreMvcModule),
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpEntityFrameworkCoreMySQLModule),
typeof(VoloAbpCommercialSuiteTemplatesModule),
// LeptonX Theme module packages
typeof(AbpAspNetCoreMvcUiLeptonXThemeModule),
typeof(AbpAspNetCoreComponentsServerLeptonXThemeModule),
// Account module packages
typeof(AbpAccountPublicWebOpenIddictModule),
typeof(AbpAccountPublicHttpApiModule),
typeof(AbpAccountPublicApplicationModule),
typeof(AbpAccountAdminBlazorServerModule),
typeof(AbpAccountAdminHttpApiModule),
typeof(AbpAccountAdminApplicationModule),
// Identity module packages
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpPermissionManagementDomainOpenIddictModule),
typeof(AbpIdentityProBlazorServerModule),
typeof(AbpIdentityHttpApiModule),
typeof(AbpIdentityApplicationModule),
typeof(AbpIdentityProEntityFrameworkCoreModule),
typeof(AbpOpenIddictProBlazorServerModule),
typeof(AbpOpenIddictProHttpApiModule),
typeof(AbpOpenIddictProApplicationModule),
typeof(AbpOpenIddictEntityFrameworkCoreModule),
// Audit logging module packages
typeof(AbpAuditLoggingBlazorServerModule),
typeof(AbpAuditLoggingHttpApiModule),
typeof(AbpAuditLoggingApplicationModule),
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
// Permission Management module packages
typeof(AbpPermissionManagementBlazorServerModule),
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
// Saas Management module packages
typeof(SaasHostBlazorServerModule),
typeof(SaasHostHttpApiModule),
typeof(SaasHostApplicationModule),
typeof(SaasEntityFrameworkCoreModule),
// Feature Management module packages
typeof(AbpFeatureManagementBlazorServerModule),
typeof(AbpFeatureManagementHttpApiModule),
typeof(AbpFeatureManagementApplicationModule),
typeof(AbpFeatureManagementEntityFrameworkCoreModule),
// Setting Management module packages
typeof(AbpSettingManagementBlazorServerModule),
typeof(AbpSettingManagementHttpApiModule),
typeof(AbpSettingManagementApplicationModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
// Text Template Management module packages
typeof(TextTemplateManagementBlazorServerModule),
typeof(TextTemplateManagementHttpApiModule),
typeof(TextTemplateManagementApplicationModule),
typeof(TextTemplateManagementEntityFrameworkCoreModule),
// Language Management module packages
typeof(LanguageManagementBlazorServerModule),
typeof(LanguageManagementHttpApiModule),
typeof(LanguageManagementApplicationModule),
typeof(LanguageManagementEntityFrameworkCoreModule),
// GDPR module packages
typeof(AbpGdprBlazorServerModule),
typeof(AbpGdprHttpApiModule),
typeof(AbpGdprApplicationModule),
typeof(AbpGdprEntityFrameworkCoreModule),
// Blob Storing
typeof(BlobStoringDatabaseEntityFrameworkCoreModule)
)]
Autofac.Core.Registration.ComponentNotRegisteredException: The requested service 'Volo.Abp.AspNetCore.Authentication.OpenIdConnect.IOpenIdLocalUserCreationClient' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.AbpOpenIdConnectExtensions.<>c.<<AddAbpOpenIdConnect>b__3_4>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.RunTokenValidatedEventAsync(OpenIdConnectMessage authorizationResponse, OpenIdConnectMessage tokenEndpointResponse, ClaimsPrincipal user, AuthenticationProperties properties, JwtSecurityToken jwt, String nonce)
at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleRemoteAuthenticateAsync()
Hey,
I have a custom Oidc Login Provider (KeyCloak) and I get this after the login Provider redirect me after successful login:
ComponentNotRegisteredException: The requested service 'Volo.Abp.AspNetCore.Authentication.OpenIdConnect.IOpenIdLocalUserCreationClient' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
Am i missing a dependency or how can I register this missing component? I cant find anything on Google about this.
Thanks!
Problem seems to be resolved. No idea what happpend. Now the Blazor Server is adding the "RequestVerificationToken" header correctly.
When I do this it works as expected:
Configure<AbpAntiForgeryOptions>(options =>
{
options.AutoValidateFilter = x => false;
});
But we need this AntiForgery stuff.
Ok it seems that we didnt deploy correctly and this was the solution:
[Dependency(ReplaceServices = true)]
public class BrandingProvider : DefaultBrandingProvider
{
public override string AppName => "MyBrandName";
}
Hey,
we are running Single Layer Application with Blazor Server.
However when we deploy to production system and run it we get this name in the tab:
We tried this:
[Dependency(ReplaceServices = true)]
public class BrandingProvider : DefaultBrandingProvider
{
public override string AppName => "MyBrandName";
}
But did not work.
How to fix this?
Thanks!
Hey,
we have a single layer template for the application with Blazor Server.
But the browser is not sending the anti forge header:
This is the log on the server:
2023-01-23 08:28:23.180 +00:00 [INF] Request starting HTTP/1.1 GET http://****/api/account/profile-picture-file/*******-0151-dd48-c2b9-b8bd5f47c15c - -
2023-01-23 08:28:23.180 +00:00 [INF] Request starting HTTP/1.1 GET http://*****/__bundles/Volo.Abp.Account.Public.Web.Pages.Account.ManageModel.****.js?_v=***- -
2023-01-23 08:28:23.186 +00:00 [INF] Executing endpoint 'Blazor disconnect'
2023-01-23 08:28:23.186 +00:00 [ERR] The required antiforgery header value "RequestVerificationToken" is not present.
2023-01-23 08:28:23.190 +00:00 [INF] Authorization failed for the request at filter 'Volo.Abp.AspNetCore.Mvc.AntiForgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter'.
2023-01-23 08:28:23.190 +00:00 [INF] Executing StatusCodeResult, setting HTTP status code 400
Should the header name be "XSRF-TOKEN" or "RequestVerificationToken" or "__RequestVerificationToken"?
Why is the blazor client not sending it?
The AbpAntiForgeryOptions is not configured on the server.
Thank!
Hey,
we migrated to LeptonX Theme and we dont know how to change the branding on the Account page.
We did this to change the branding on the other pages and it works nicely: https://docs.abp.io/en/commercial/latest/themes/lepton-x/mvc#main-header-branding
We did the branding change in both the Blazor and AuthServer project. But the branding on the Acccount Login Page still stays default.
The only thing that is shown is how to change the Account Layout: https://docs.abp.io/en/commercial/latest/themes/lepton-x/mvc#account-layout
But this does not even work. And I cant find any addtional documentation for this.
Thanks!
Hey,
I have no clue how to reproduce this. We migrated from 5.3.3 to 6.0.0 and changed a lot of files.
The warning appears in the Blazor application.
Here is the module for it, maybe you can find something missing here:
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
using Conzepta.Lexica.Cloud.Blazor.Menus;
using Conzepta.Lexica.Cloud.Localization;
using Conzepta.Lexica.Cloud.MultiTenancy;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using Microsoft.OpenApi.Models;
using StackExchange.Redis;
using System;
using System.IO;
using Volo.Abp;
using Volo.Abp.Account.Pro.Admin.Blazor.Server;
using Volo.Abp.Account.Pro.Public.Blazor.Server;
using Volo.Abp.Account.Public.Web.Impersonation;
using Volo.Abp.AspNetCore.Authentication.OpenIdConnect;
using Volo.Abp.AspNetCore.Components.Server.LeptonXTheme;
using Volo.Abp.AspNetCore.Components.Server.LeptonXTheme.Bundling;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
using Volo.Abp.AspNetCore.Mvc.Client;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.Blazor.Server;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.Gdpr.Blazor.Server;
using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Http.Client.Web;
using Volo.Abp.Identity.Pro.Blazor;
using Volo.Abp.Identity.Pro.Blazor.Server;
using Volo.Abp.LanguageManagement.Blazor.Server;
using Volo.Abp.LeptonX.Shared;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.OpenIddict.Pro.Blazor.Server;
using Volo.Abp.Swashbuckle;
using Volo.Abp.TextTemplateManagement.Blazor.Server;
using Volo.Abp.UI.Navigation;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.VirtualFileSystem;
using Volo.Saas.Host.Blazor;
using Volo.Saas.Host.Blazor.Server;
namespace Conzepta.Lexica.Cloud.Blazor;
[DependsOn(
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAutofacModule),
typeof(AbpSwashbuckleModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAspNetCoreMvcClientModule),
typeof(AbpAspNetCoreAuthenticationOpenIdConnectModule),
typeof(AbpHttpClientWebModule),
typeof(AbpAccountPublicWebImpersonationModule),
typeof(AbpHttpClientIdentityModelWebModule),
typeof(AbpAspNetCoreMvcUiLeptonXThemeModule),
typeof(AbpAspNetCoreComponentsServerLeptonXThemeModule),
typeof(AbpAccountAdminBlazorServerModule),
typeof(AbpAccountPublicBlazorServerModule),
typeof(AbpAuditLoggingBlazorServerModule),
typeof(AbpIdentityProBlazorServerModule),
typeof(AbpOpenIddictProBlazorServerModule),
typeof(LanguageManagementBlazorServerModule),
typeof(SaasHostBlazorServerModule),
typeof(TextTemplateManagementBlazorServerModule),
typeof(AbpGdprBlazorServerModule),
typeof(CloudHttpApiClientModule)
)]
public class CloudBlazorModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options =>
{
options.AddAssemblyResource(
typeof(CloudResource),
typeof(CloudDomainSharedModule).Assembly,
typeof(CloudApplicationContractsModule).Assembly,
typeof(CloudBlazorModule).Assembly
);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
ConfigureUrls(configuration);
ConfigureBundles();
ConfigureAuthentication(context, configuration);
ConfigureImpersonation(context, configuration);
ConfigureAutoMapper();
ConfigureVirtualFileSystem(hostingEnvironment);
ConfigureLocalizationServices();
ConfigureSwaggerServices(context.Services);
ConfigureCache(configuration);
ConfigureDataProtection(context, configuration, hostingEnvironment);
ConfigureBlazorise(context);
ConfigureRouter();
ConfigureMenu(configuration);
ConfigureLeptonTheme();
ConfigureCore(context, configuration);
}
private void ConfigureUrls(IConfiguration configuration)
{
Configure<AppUrlOptions>(options =>
{
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
});
}
private void ConfigureBundles()
{
Configure<AbpBundlingOptions>(options =>
{
// MVC UI
options.StyleBundles.Configure(
LeptonXThemeBundles.Styles.Global,
bundle =>
{
bundle.AddFiles("/global-styles.css");
}
);
// Blazor UI
options.StyleBundles.Configure(
BlazorLeptonXThemeBundles.Styles.Global,
bundle =>
{
bundle.AddFiles("/blazor-global-styles.css");
//You can remove the following line if you don't use Blazor CSS isolation for components
bundle.AddFiles("/Conzepta.Lexica.Cloud.Blazor.styles.css");
}
);
});
}
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie("Cookies", options =>
{
options.ExpireTimeSpan = TimeSpan.FromDays(365);
})
.AddAbpOpenIdConnect("oidc", options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);;
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.ClientId = configuration["AuthServer:ClientId"];
options.ClientSecret = configuration["AuthServer:ClientSecret"];
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("roles");
options.Scope.Add("email");
options.Scope.Add("phone");
options.Scope.Add("Cloud");
});
}
private void ConfigureImpersonation(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.Configure<SaasHostBlazorOptions>(options =>
{
options.EnableTenantImpersonation = true;
});
context.Services.Configure<AbpIdentityProBlazorOptions>(options =>
{
options.EnableUserImpersonation = true;
});
}
private void ConfigureVirtualFileSystem(IWebHostEnvironment hostingEnvironment)
{
if (hostingEnvironment.IsDevelopment())
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.ReplaceEmbeddedByPhysical<CloudDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Conzepta.Lexica.Cloud.Domain.Shared"));
options.FileSets.ReplaceEmbeddedByPhysical<CloudApplicationContractsModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Conzepta.Lexica.Cloud.Application.Contracts"));
options.FileSets.ReplaceEmbeddedByPhysical<CloudBlazorModule>(hostingEnvironment.ContentRootPath);
});
}
}
private void ConfigureSwaggerServices(IServiceCollection services)
{
services.AddAbpSwaggerGen(
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Cloud API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
}
);
}
private void ConfigureLocalizationServices()
{
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("ar", "ar", "العربية", "ae"));
options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština"));
options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)"));
options.Languages.Add(new LanguageInfo("hu", "hu", "Magyar"));
options.Languages.Add(new LanguageInfo("fi", "fi", "Finnish", "fi"));
options.Languages.Add(new LanguageInfo("fr", "fr", "Français", "fr"));
options.Languages.Add(new LanguageInfo("hi", "hi", "Hindi", "in"));
options.Languages.Add(new LanguageInfo("it", "it", "Italiano", "it"));
options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português"));
options.Languages.Add(new LanguageInfo("ru", "ru", "Русский", "ru"));
options.Languages.Add(new LanguageInfo("sk", "sk", "Slovak", "sk"));
options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文"));
options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsch", "de"));
options.Languages.Add(new LanguageInfo("es", "es", "Español"));
});
}
private void ConfigureCache(IConfiguration configuration)
{
Configure<AbpDistributedCacheOptions>(options =>
{
options.KeyPrefix = "Cloud:";
});
}
private void ConfigureDataProtection(
ServiceConfigurationContext context,
IConfiguration configuration,
IWebHostEnvironment hostingEnvironment)
{
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("Cloud");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "Cloud-Protection-Keys");
}
}
private void ConfigureBlazorise(ServiceConfigurationContext context)
{
context.Services
.AddBootstrap5Providers()
.AddFontAwesomeIcons();
}
private void ConfigureMenu(IConfiguration configuration)
{
Configure<AbpNavigationOptions>(options =>
{
options.MenuContributors.Add(new CloudMenuContributor(configuration));
});
}
private void ConfigureLeptonTheme()
{
Configure<LeptonXThemeOptions>(options =>
{
options.DefaultStyle = LeptonXStyleNames.Light;
});
}
private void ConfigureRouter()
{
Configure<AbpRouterOptions>(options =>
{
options.AppAssembly = typeof(CloudBlazorModule).Assembly;
});
}
private void ConfigureAutoMapper()
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<CloudBlazorModule>();
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var env = context.GetEnvironment();
var app = context.GetApplicationBuilder();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseAbpRequestLocalization();
if (!env.IsDevelopment())
{
app.UseErrorPage();
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseCorrelationId();
app.UseAbpSecurityHeaders();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
if (MultiTenancyConsts.IsEnabled)
{
app.UseMultiTenancy();
}
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Cloud API");
});
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints();
}
private void ConfigureCore(ServiceConfigurationContext context, IConfiguration configuration)
{
// redacted
}
}