小编swb*_*haw的帖子

ASP.NET OWIN OpenID Connect 不创建用户身份验证

我有一个 ASP.NET 4.6 Web 应用程序,我正在尝试使用 OWIN 添加 OpenId Connect。

我添加了我的 Owin 启动类,一切似乎都配置正确,但我遇到的问题是永远不会创建 ASP 身份/身份验证用户。我结束了一个无限循环,其中 OpenId 回调页面重定向回原始页面,然后重定向到登录页面等。

这是我的启动类:

public void Configuration(IAppBuilder app)
    {


     app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);


        app.UseKentorOwinCookieSaver();
        app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Login.aspx"),
            ExpireTimeSpan = TimeSpan.FromDays(7)
        });

        app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
        {                
            ClientId = _clientId,
            ClientSecret = _clientSecret,
            Authority = _authority,
            RedirectUri = _redirectUri, // LoginCallback
            PostLogoutRedirectUri = "http://localhost:60624/Logout.aspx",

            ResponseType = OpenIdConnectResponseType.CodeIdToken,
            Scope = "openid profile email",

            TokenValidationParameters = new TokenValidationParameters
            {
                NameClaimType = "name"
            },

            Notifications = new OpenIdConnectAuthenticationNotifications
            { …
Run Code Online (Sandbox Code Playgroud)

c# owin owin-middleware openid-connect

6
推荐指数
1
解决办法
4375
查看次数

标签 统计

c# ×1

openid-connect ×1

owin ×1

owin-middleware ×1