Я пытаюсь использовать OID C с моим Azure веб-приложением. Это приложение *. 1013 * CORE 3.1. Страница входа в систему Microsoft загружается, я могу войти в систему, а затем я перенаправлен на путь обратного вызова, который я указал в приложении, но я всегда получаю ошибку 500 «Ошибка корреляции», когда она перенаправляет меня на обратный вызов URL "/ signin-oid c":
![enter image description here](https://i.stack.imgur.com/5btXH.png)
public class Startup
{
public Startup(IHostingEnvironment environment)
{
Configuration = new ConfigurationBuilder()
.SetBasePath(environment.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.Build();
Env = environment;
}
public IConfigurationRoot Configuration { get; }
public IHostingEnvironment Env { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddAzureAd(options => Configuration.Bind("AzureAd", options))
.AddCookie( x =>
{
x.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.None;
x.Cookie.SecurePolicy = Microsoft.AspNetCore.Http.CookieSecurePolicy.Always;
});
// azure blob referances
services.Configure<BlobSettings>(options =>
{
options.BlobContainer = Configuration.GetSection("AzureStorageConnection:ContainerName").Value;
options.PortalBlobContainer = Configuration.GetSection("AzureStorageConnection:PortalContainerName").Value;
options.ConnectionString = Configuration.GetSection("AzureStorageConnection:ConnectionStringDEV").Value;
});
services.AddTransient<IAzureBlobStorage, AzureBlobStorage>();
services.Configure<ADSettings>(options =>
{
options.AppId = Configuration.GetSection("CRMSettings:appId").Value;
options.Secret = Configuration.GetSection("CRMSettings:appSecret").Value;
options.AppUrl = Configuration.GetSection("CRMSettings:appURLDEV").Value;
});
services.AddTransient<ICRMService, DynamicsCRMService>();
// SecurityInfo
services.Configure<PrivacySettings>(options =>
{
options.AllowDeleteSettings = Configuration.GetSection("FileSystemPrivacies:AllowToDelete").Get<List<AllowPolicies>>();
options.AllowAddSettings = Configuration.GetSection("FileSystemPrivacies:AllowToUpload").Get<List<AllowPolicies>>();
});
services.AddSingleton<IConfiguration>(Configuration);
services.AddMvc(option => option.EnableEndpointRouting = false);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseAuthentication();
app.UseSecurityHeadersMiddleware(new SecurityHeadersBuilder()
.AddCustomHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""));
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
}
Заполняет параметры Azure следующим образом:
options.ClientId = _azureOptions.ClientId;
options.Authority = $"{_azureOptions.Instance}{_azureOptions.TenantId}";
options.UseTokenLifetime = true;
options.CallbackPath = _azureOptions.CallbackPath;
options.RequireHttpsMetadata = false;