Azure应用程序服务容器是否支持具有开放ID Connect的Blazor应用程序?

Azure应用程序服务容器是否支持具有开放ID Connect的Blazor应用程序?,azure,docker,blazor,asp.net-blazor,Azure,Docker,Blazor,Asp.net Blazor,问题 将Blazor webassembly应用程序部署为应用程序服务容器后,浏览器中出现以下错误: AuthenticationService.js:1 Mixed Content: The page at 'https://YYY.azurewebsites.net/authentication/login?returnUrl=https%3A%2F%2FYYY.azurewebsites.net%2Ffetchdata' was loaded over HTTPS, but request

问题 将Blazor webassembly应用程序部署为应用程序服务容器后,浏览器中出现以下错误:

AuthenticationService.js:1 Mixed Content: The page at 'https://YYY.azurewebsites.net/authentication/login?returnUrl=https%3A%2F%2FYYY.azurewebsites.net%2Ffetchdata' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://YYY.azurewebsites.net/.well-known/openid-configuration'. This request has been blocked; the content must be served over HTTPS.
想知道Blazor目前是否支持docker部署,如果支持,我们如何解决这个问题

重新专业的步骤: 1.在VS 2019 Professional preview版本16.7.0 preview 2.0中:创建Blazor应用程序(标准的“Blazor WebAssembly应用程序”模板),并在Identity Server上使用托管选项和应用程序内身份验证 2.将linux docker容器部署到Azure Web App for containers服务(B1) 3.应用程序服务的仅HTTPS设置处于启用状态

为此,我们使用以下简单docker文件:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS runtime
WORKDIR /app
EXPOSE 80
COPY . .
ENTRYPOINT ["dotnet", "AppNameHere.Server.dll"]
Blazor使用的OIDC JS库没有意识到我们是通过HTTPS运行的(尽管HTTP在容器实例和应用程序服务负载平衡器之间使用)。

您应该:

  • 为您的端点安装HTTPS证书并运行完整的端到端HTTPS(推荐)
    要使用docker read上的证书设置kestrel
  • 覆盖应用程序使用的OIDC配置:
创建metadata.json文件

{
    "issuer": "http://YYY.azurewebsites.net",
    "jwks_uri": "https://YYY.azurewebsites.net/.well-known/openid-configuration/jwks",
    "authorization_endpoint": "https://YYY.azurewebsites.net/connect/authorize",
    "token_endpoint": "https://YYY.azurewebsites.net/connect/token",
    "userinfo_endpoint": "https://YYY.azurewebsites.net/connect/userinfo",
    "end_session_endpoint": "https://YYY.azurewebsites.net/connect/endsession",
    "check_session_iframe": "https://YYY.azurewebsites.net/connect/checksession"
}
“颁发者”:“”是HTTP url而不是HTTPS

配置应用程序以从自定义文件获取元数据

{
    "issuer": "http://YYY.azurewebsites.net",
    "jwks_uri": "https://YYY.azurewebsites.net/.well-known/openid-configuration/jwks",
    "authorization_endpoint": "https://YYY.azurewebsites.net/connect/authorize",
    "token_endpoint": "https://YYY.azurewebsites.net/connect/token",
    "userinfo_endpoint": "https://YYY.azurewebsites.net/connect/userinfo",
    "end_session_endpoint": "https://YYY.azurewebsites.net/connect/endsession",
    "check_session_iframe": "https://YYY.azurewebsites.net/connect/checksession"
}
公共类程序
{
公共静态异步任务主(字符串[]args)
{
var builder=WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add(“应用程序”);
builder.Services.AddOidcAuthentication(选项=>
{
var providerOptions=options.providerOptions;
providerOptions.Authority=”https://YYY.azurewebsites.net";
providerOptions.MetadataUrl=”https://YYY.azurewebsites.net/metadata.json";
providerOptions.PostLogoutRedirectUri=”https://YYY.azurewebsites.net/authentication/logout-callback";
providerOptions.RedirectUri=”https://YYY.azurewebsites.net/login-callback";
});
等待builder.Build().RunAsync();
}
}

谢谢!谢谢!当我们尝试运行e2e https时,我们遇到了一个小问题-web应用程序不会为docker容器发布https端口,它发布唯一的http端口,有什么办法克服这个问题吗?(Https端口在dockerfile中公开)是的:您能指出一些资源,其中指出推荐使用完整的端到端Https吗?我想了解更多的优点和缺点。另外,我们如何处理证书?是否可以重用应用程序服务管理的证书,或者我必须创建一个新的证书?关于端到端HTTPS:关于Azure证书管理,我没有足够的技能