Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to implement a custom identity provider based on LiteDb.Identity for a Blazor app?

$
0
0

I am trying to implement a LiteDb Identity provider. I have a template blazor app and I want to implement a custom Identity with LiteDB using https://github.com/quicksln/LiteDB.Identity. I managed to get to a certain point, but I get an error that I cannot fix.

This is my Program.cs

    var builder = WebApplication.CreateBuilder(args);    // Add services to the container.    var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");    builder.Services.AddLiteDBIdentity(connectionString);    builder.Services.AddIdentity<LiteDbUser, LiteDbRole>();    builder.Services.AddControllersWithViews();    builder.Services.AddRazorPages();    var app = builder.Build();    // Configure the HTTP request pipeline.    if (app.Environment.IsDevelopment())    {        app.UseWebAssemblyDebugging();    }    else    {        app.UseExceptionHandler("/Error");        // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.        app.UseHsts();    }    app.UseHttpsRedirection();    app.UseBlazorFrameworkFiles();    app.UseStaticFiles();    app.UseRouting();    app.UseAuthentication();    app.MapRazorPages();    app.MapControllers();    app.MapFallbackToFile("index.html");    app.Run();

this is my appsettings.json

{"ConnectionStrings": {"DefaultConnection": "Filename=./Data/IdentityLiteDB.dll;Password=1234;Connection=Shared"  },"Logging": {"LogLevel": {"Default": "Information","Microsoft.AspNetCore": "Warning"    }  },"AllowedHosts": "*"}

I have replaced all instances of ApplicationUser to LiteDbUser (SignInManager, UserManager..) and I have an OidcConfigurationController. Should be enough, but when ran, I get this error

 System.InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.ApiAuthorization.IdentityServer.IClientRequestParametersProvider' while attempting to activate 'OidcConfigurationController'.         at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ThrowHelperUnableToResolveService(Type type, Type requiredBy)

Any tips how to proceed with this implementation?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>