Skip to content

Commit e1e6f00

Browse files
committed
Updates
1 parent 5e2218e commit e1e6f00

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

aspnetcore/blazor/call-web-api.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ Production web apps and web APIs should use a production distributed token cache
103103
> ```csharp
104104
> builder.Services.AddInMemoryTokenCaches();
105105
> ```
106+
>
107+
> Later in the development and testing period, adopt a production distributed token cache provider.
106108
107109
<xref:Microsoft.Extensions.DependencyInjection.MemoryCacheServiceCollectionExtensions.AddDistributedMemoryCache%2A> adds a default implementation of <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> that stores cache items in memory, which is used by Microsoft Identity Web for token caching.
108110
@@ -118,6 +120,17 @@ To configure a production distributed cache provider, see <xref:performance/cach
118120
119121
For more information, see [Token cache serialization: Distributed caches](/entra/msal/dotnet/how-to/token-cache-serialization?tabs=msal#distributed-caches). However, the code examples shown don't apply to ASP.NET Core apps, which configure distributed caches via <xref:Microsoft.Extensions.DependencyInjection.MemoryCacheServiceCollectionExtensions.AddDistributedMemoryCache%2A>, not <xref:Microsoft.Identity.Web.TokenCacheExtensions.AddDistributedTokenCache%2A>.
120122
123+
Use a shared Data Protection key ring in production so that instances of the app across servers in a web farm can decrypt tokens when <xref:Microsoft.Identity.Web.TokenCacheProviders.Distributed.MsalDistributedTokenCacheAdapterOptions.Encrypt%2A?displayProperty=nameWithType> is set to `true`.
124+
125+
> [!NOTE]
126+
> For early development and local testing on a single machine, you can set <xref:Microsoft.Identity.Web.TokenCacheProviders.Distributed.MsalDistributedTokenCacheAdapterOptions.Encrypt%2A> to `false` and configure a shared Data Protection key ring later:
127+
>
128+
> ```csharp
129+
> options.Encrypt = false;
130+
> ```
131+
>
132+
> Later in the development and testing period, enable token encryption and adopt a shared Data Protection key ring.
133+
121134
The following example shows how to use [Azure Blob Storage and Azure Key Vault](xref:security/data-protection/configuration/overview#protectkeyswithazurekeyvault) for the shared key ring. Add the following packages to the server project of the Blazor Web App:
122135
123136
* [`Azure.Extensions.AspNetCore.DataProtection.Blobs`](https://www.nuget.org/packages/Azure.Extensions.AspNetCore.DataProtection.Blobs)

aspnetcore/blazor/security/blazor-web-app-with-entra.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,8 @@ Production web apps and web APIs should use a production distributed token cache
703703
> ```csharp
704704
> builder.Services.AddInMemoryTokenCaches();
705705
> ```
706+
>
707+
> Later in the development and testing period, adopt a production distributed token cache provider.
706708
707709
<xref:Microsoft.Extensions.DependencyInjection.MemoryCacheServiceCollectionExtensions.AddDistributedMemoryCache%2A> adds a default implementation of <xref:Microsoft.Extensions.Caching.Distributed.IDistributedCache> that stores cache items in memory, which is used by Microsoft Identity Web for token caching.
708710
@@ -741,6 +743,15 @@ For more information, see [Token cache serialization: Distributed caches](/entra
741743

742744
Use a shared Data Protection key ring in production so that instances of the app across servers in a web farm can decrypt tokens when <xref:Microsoft.Identity.Web.TokenCacheProviders.Distributed.MsalDistributedTokenCacheAdapterOptions.Encrypt%2A?displayProperty=nameWithType> is set to `true`.
743745

746+
> [!NOTE]
747+
> For early development and local testing on a single machine, you can set <xref:Microsoft.Identity.Web.TokenCacheProviders.Distributed.MsalDistributedTokenCacheAdapterOptions.Encrypt%2A> to `false` and configure a shared Data Protection key ring later:
748+
>
749+
> ```csharp
750+
> options.Encrypt = false;
751+
> ```
752+
>
753+
> Later in the development and testing period, enable token encryption and adopt a shared Data Protection key ring.
754+
744755
The following example shows how to use [Azure Blob Storage and Azure Key Vault](xref:security/data-protection/configuration/overview#protectkeyswithazurekeyvault) for the shared key ring. Add the following packages to the server project of the Blazor Web App:
745756
746757
* [`Azure.Extensions.AspNetCore.DataProtection.Blobs`](https://www.nuget.org/packages/Azure.Extensions.AspNetCore.DataProtection.Blobs)

0 commit comments

Comments
 (0)