在ASP.NET Core中的OpenID中使用承载身份验证方案

时间:2019-09-02 16:13:18

标签: c# asp.net-core openid openid-connect

假设我们正在使用this OpenID Connect sample

这是OpenID的添加方式:

    services.AddAuthentication(options => {
                options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
            })
            .AddCookie(options => {
                options.LoginPath = "/Account/Login/";
            })
            .AddOpenIdConnect(options =>
                {
                    options.ClientId = ONELOGIN_OPENID_CONNECT_CLIENT_ID;
                    options.ClientSecret = ONELOGIN_OPENID_CONNECT_CLIENT_SECRET;

                    // For EU Authority use: "https://openid-connect-eu.onelogin.com/oidc";
                    options.Authority = "https://openid-connect.onelogin.com/oidc";

                    options.ResponseType = "code";
                    options.GetClaimsFromUserInfoEndpoint = true;
                }
            );

如何使用Bearer身份验证方案代替cookie?我想处理用户信息并将其存储在数据库中。

0 个答案:

没有答案