Identityserver4 没有为方案注册身份验证处理程序';oidc';Identity Server 4.0
我正在使用Identity Server 4.0尝试为用户autenticaion和何时创建Mictosoft标识 尝试创建mvc客户端时,我遇到异常InvalidOperationException:Identityserver4 没有为方案注册身份验证处理程序';oidc';Identity Server 4.0,identityserver4,openid-connect,Identityserver4,Openid Connect,我正在使用Identity Server 4.0尝试为用户autenticaion和何时创建Mictosoft标识 尝试创建mvc客户端时,我遇到异常InvalidOperationException: No authentication handler is registered for the scheme 'oidc'. The registered schemes are: Identity.Application, Identity.External, Identity.TwoFact
No authentication handler is registered for the scheme 'oidc'. The registered schemes are: Identity.Application, Identity.External, Identity.TwoFactorRememberMe, Identity.TwoFactorUserId, idsrv, idsrv.external. Did you forget to call AddAuthentication().Add[SomeAuthHandler]("oidc",...)?
这是identity Server应用程序中的我的AddServices
protected override IServiceCollection AddServices(
IServiceCollection services)
{
string inboxIdentityConnectionString = Configuration
.GetConnectionString("InboxIdentityConnectionString");
string identityServerConnectionString = Configuration
.GetConnectionString("IdentityServerConnectionString");
services.AddIdentity<ApplicationUser, ApplicationRole>(
config =>
{
// Sign-In
config.SignIn.RequireConfirmedEmail = true;
config.SignIn.RequireConfirmedPhoneNumber = false;
// Password settings
config.Password.RequireDigit = true;
config.Password.RequiredLength = 10;
config.Password.RequireNonAlphanumeric = true;
config.Password.RequireUppercase = true;
config.Password.RequireLowercase = true;
// Lockout settings
config.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(30);
config.Lockout.MaxFailedAccessAttempts = 3;
config.Lockout.AllowedForNewUsers = true;
// User settings
config.User.RequireUniqueEmail = true;
})
.AddEntityFrameworkStores<InboxIdentityDbContext>()
.AddDefaultTokenProviders();
services.AddDbContext<InboxIdentityDbContext>(
options =>
options.UseSqlServer(inboxIdentityConnectionString));
services.AddIdentityServer(
options =>
{
options.Events.RaiseErrorEvents = true;
options.Events.RaiseInformationEvents = true;
options.Events.RaiseFailureEvents = true;
options.Events.RaiseSuccessEvents = true;
})
// see the IdentityServerBuilderExtensions - this extension also adds the
// custom user claims via the injection of the InboxInsightProfileService
.AddAspNetIdentity<ApplicationUser>()
.AddConfigurationStore(
options =>
{
options.ConfigureDbContext = builder =>
builder.UseSqlServer(identityServerConnectionString);
})
.AddOperationalStore(
options =>
{
options.ConfigureDbContext = builder =>
builder.UseSqlServer(identityServerConnectionString);
// this enables automatic token cleanup. this is optional.
options.EnableTokenCleanup = true;
options.TokenCleanupInterval = 60; // interval in seconds, short for testing
})
.AddDeveloperSigningCredential();
return services;
}
您是否在MVC客户端启动类中添加了以下内容
app.UseAuthentication();
app.UseAuthorization();
app.UseAuthentication();
app.UseAuthorization();