我正在尝试创建一个asp.net核心API,使用firebase身份验证验证用户身份,并将所有数据存储在内部postgreSQL数据库中 - 包括授权规则(如管理员和其他自定义规则) .
我管理使用firebase nuget包验证令牌:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDBContext>(options => options.UseNpgsql(
Configuration.GetConnectionString("DeafultConnectionString")));
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddFirebaseAuthentication(Configuration.GetSection("FirebaseAuth:issuer").Value,
Configuration.GetSection("FirebaseAuth:audience").Value);
// services.AddIdentity<Auth.ApplicationUser, IdentityRole>().AddEntityFrameworkStores<ApplicationDBContext>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseHsts();
}
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseMvc();
}
}
这很好用!我试图了解如何连接数据库以存储用户详细信息 - 但我无法理解它是如何完成的 . 任何帮助?