在Azure上共享多个应用程序上的密钥

时间:2023-01-24 13:24:24

We're facing a problem is that we want to install the same ASP.Net Core WebApp in multiple locations and route users using traffic managers but if we do that, we get issues because the authentication tokens get stored in one server and the user may access another one. I read that we can use Azure BlobStorage to share the keys, can someone please describe how?

我们面临的一个问题是,我们希望在多个位置安装相同的ASP.Net Core WebApp并使用流量管理器路由用户但是如果我们这样做,我们会遇到问题,因为身份验证令牌存储在一个服务器中,用户可能会访问另一个。我读过我们可以使用Azure BlobStorage来共享密钥,有人可以描述一下吗?

We use openiddict for API login but I think that this doesn't affect the issue if we can use Azure BlobStorage for key storage.

我们使用openiddict进行API登录,但我认为如果我们可以使用Azure BlobStorage进行密钥存储,这不会影响问题。

Thank you

谢谢

1 个解决方案

#1


1  

As indicated in the documentation, you must reference the Microsoft.AspNetCore.DataProtection.AzureStorage package and use PersistKeysToAzureBlobStorage() to register the Azure Blob Storage key repository:

如文档中所示,您必须引用Microsoft.AspNetCore.DataProtection.AzureStorage包并使用PersistKeysToAzureBlobStorage()注册Azure Blob存储密钥存储库:

public void ConfigureServices(IServiceCollection services)
{
    services.AddDataProtection()
        .PersistKeysToAzureBlobStorage(new Uri("<blob URI including SAS token>"));
}

#1


1  

As indicated in the documentation, you must reference the Microsoft.AspNetCore.DataProtection.AzureStorage package and use PersistKeysToAzureBlobStorage() to register the Azure Blob Storage key repository:

如文档中所示,您必须引用Microsoft.AspNetCore.DataProtection.AzureStorage包并使用PersistKeysToAzureBlobStorage()注册Azure Blob存储密钥存储库:

public void ConfigureServices(IServiceCollection services)
{
    services.AddDataProtection()
        .PersistKeysToAzureBlobStorage(new Uri("<blob URI including SAS token>"));
}