gpt4 book ai didi

c# - 启动后启用/禁用身份验证选项

转载 作者:行者123 更新时间:2023-11-30 18:31:17 25 4
gpt4 key购买 nike

我想创建一个自定义 CMS,管理员可以在其管理面板中选择所有可能的登录选项。但我只能在我的 Startup.cs 中为 OWIN 设置第三方登录:

public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

// Uncomment the following lines to enable logging in with third party login providers
app.UseMicrosoftAccountAuthentication(
clientId: "00000000000000000",
clientSecret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

app.UseTwitterAuthentication(
consumerKey: "xxxxxxxxxxxxxxxxxxxxxx",
consumerSecret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

app.UseFacebookAuthentication(
appId: "000000000000000",
appSecret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

app.UseGoogleAuthentication();
}
}

我想在我正在运行的应用程序中启用和禁用这些登录选项。因此启动后。这可能吗?如果可能,如何实现?

最佳答案

大多数登录流程都是由用户从列表中选择一个身份验证提供程序触发的。您可以只显示/隐藏该列表中的项目。

关于c# - 启动后启用/禁用身份验证选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20419396/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com