Использование Microsoft.Owin.Security.OpenIdConnect с потоком проверки подлинности «кода» - PullRequest
0 голосов
/ 05 октября 2018

Я искал запрос на изменение на одном из сайтов нашего клиента, чтобы изменить аутентификацию OpenIdConnect с неявного потока на поток кода.Кажется, он выполняет только часть процесса аутентификации.

Кто-нибудь получил эту работу?

Вот мой код:

public void ConfigureAuth(IAppBuilder app)
{
    app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

    app.UseCookieAuthentication(new CookieAuthenticationOptions());

    var options = new OpenIdConnectAuthenticationOptions
    {
        ClientId = WebConfigurationManager.AppSettings["OpenIdClientId"],
        ClientSecret = WebConfigurationManager.AppSettings["OpenIdClientSecret"],
        Authority = WebConfigurationManager.AppSettings["OpenIdAuthority"],
        Scope = "openid profile email",
        ResponseType = "code",

        Notifications = new OpenIdConnectAuthenticationNotifications
        {
            RedirectToIdentityProvider = n =>
            {
                return Task.FromResult(0);
            },
            AuthenticationFailed = x =>
            {
                return Task.FromResult(0);
            },
            AuthorizationCodeReceived = x =>
            {
                //Only used in "Hybrid" flow
                return Task.FromResult(0);
            },
            MessageReceived = x =>
            {
                return Task.FromResult(0);
            },
            SecurityTokenReceived = x =>
            {
                return Task.FromResult(0);
            },
            SecurityTokenValidated = n =>
            {
                return Task.FromResult(0);
            }
        }
    };

    app.UseOpenIdConnectAuthentication(options);
}
...