File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9797 . Configure < IISServerOptions > ( x => x . AllowSynchronousIO = true ) ;
9898
9999builder . Services . AddSession ( ) ;
100+ builder . Services . AddDataProtectionSetup ( ) ;
100101builder . Services . AddControllers ( o =>
101102 {
102103 o . Filters . Add ( typeof ( GlobalExceptionsFilter ) ) ;
Original file line number Diff line number Diff line change 1010 <PackageReference Include =" Com.Ctrip.Framework.Apollo.Configuration" Version =" 2.10.2" />
1111 <PackageReference Include =" Consul" Version =" 1.7.14.1" />
1212 <PackageReference Include =" Microsoft.AspNetCore.Authentication.JwtBearer" Version =" 8.0.0" />
13+ <PackageReference Include =" Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version =" 8.0.6" />
1314 <PackageReference Include =" Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version =" 8.0.0" />
1415 <PackageReference Include =" Microsoft.AspNetCore.SignalR" Version =" 1.1.0" />
1516 <PackageReference Include =" Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version =" 8.0.0" />
Original file line number Diff line number Diff line change 1+ using Blog . Core . Common ;
2+ using Blog . Core . Common . Option ;
3+ using Microsoft . AspNetCore . DataProtection ;
4+ using Microsoft . Extensions . DependencyInjection ;
5+ using StackExchange . Redis ;
6+
7+ namespace Blog . Core . Extensions . ServiceExtensions ;
8+
9+ public static class DataProtectionSetup
10+ {
11+ public static void AddDataProtectionSetup ( this IServiceCollection services )
12+ {
13+ var builder = services . AddDataProtection ( ) ;
14+
15+ var redisOption = App . GetOptions < RedisOptions > ( ) ;
16+ if ( redisOption . Enable )
17+ {
18+ builder . PersistKeysToStackExchangeRedis ( App . GetService < IConnectionMultiplexer > ( ) ) ;
19+ }
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments