[英]asp.net core authentication using firebase
我正在尝试创建一个asp.net核心api,以使用firebase身份验证来验证用户身份,并将其所有数据存储在内部postgreSQL数据库中-包括授权规则(例如Admin和其他自定义规则)。
我设法使用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();
}
}
而且效果很好! 我试图了解如何连接数据库以存储用户详细信息-但我无法理解它是如何完成的。 有什么帮助吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.