Ошибка корреляции на Identity Server 4 - PullRequest
3 голосов
/ 14 января 2020

У меня есть Identity Server 4 , настроенный с OpenIdConnect для Azure AD.

Когда пользователь нажимает кнопку входа в систему, IS4 перенаправляет на Azure AD и при обратном вызове на IS4, он показывает эту ошибку:

enter image description here

Вот как я запрашиваю токен у почтальона:

enter image description here

Обратите внимание, что URL обратного вызова является форматом мобильного приложения.

Это моя конфигурация:

services.AddAuthentication()
        .AddCookie(options => new CookieAuthenticationOptions
        {
            ExpireTimeSpan = TimeSpan.FromHours(12),
            SlidingExpiration = false,
            Cookie = new CookieBuilder
            {
                Path = "",
                Name = "MyCookie"
            }
        }).AddOpenIdConnect(options =>
        {
            options.ClientId = configuration["OpenIdConnect:ClientId"];
            options.Authority = configuration["OpenIdConnect:Authority"];
            options.SignedOutRedirectUri = configuration["OpenIdConnect:PostLogoutRedirectUri"];
            options.CallbackPath = configuration["OpenIdConnect:CallbackPath"];
            options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
            options.Resource = configuration["OpenIdConnect:Resource"];
            options.ClientSecret = configuration["OpenIdConnect:ClientSecret"];
            options.SaveTokens = true;
            options.RequireHttpsMetadata = false;

            options.TokenValidationParameters = new TokenValidationParameters
            {
                NameClaimType = "name",
                RoleClaimType = "role"
            };
            options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;

        });

И это мои параметры:

  "OpenIdConnect": {
    "ClientId": "xxxxxxxxxx",
    "Authority": "https://login.microsoftonline.com/xxxxxxxxxx/",
    "PostLogoutRedirectUri": "https://uri-of-my-identity-server.azurewebsites.net",
    "CallbackPath": "/signin-oidc",
    "ResponseType": "code id_token",
    "Resource": "https://graph.microsoft.com/",
    "ClientSecret": "my-secret"
  },

enter image description here

Примечание: эта ошибка возникает только в Azure среде (не локально)

Примечание: в приложении Xamarin, когда Azure возвращается к экрану согласия IS4 и показывает это сообщение:

enter image description here

1 Ответ

0 голосов
/ 23 января 2020

Возможно, существует проблема с сетью между вашим клиентом и Azure. Определенный порт не был открыт или балансировщик нагрузки находится между ними.

When decryption fails, state is null, thus resulting in a Correlation failed: state not found error. In our case, decryption failed because different keys were used for encryption/decryption, a pretty common problem when deploying behind a load balancer.
...