File tree Expand file tree Collapse file tree
Applications/Backend/Source/HttpsRichardy.Federation.WebApi/Extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,9 +8,11 @@ public static IServiceCollection AddJwtAuthentication(this IServiceCollection se
88 var serviceProvider = services . BuildServiceProvider ( ) ;
99 var secretRepository = serviceProvider . GetRequiredService < ISecretCollection > ( ) ;
1010
11- var secret = secretRepository . GetSecretAsync ( ) . GetAwaiter ( ) . GetResult ( ) ;
12- var publicKey = Common . Utilities . RsaHelper . CreateSecurityKeyFromPublicKey ( secret . PublicKey ) ;
11+ var secret = secretRepository . GetSecretAsync ( )
12+ . GetAwaiter ( )
13+ . GetResult ( ) ;
1314
15+ var publicKey = Common . Utilities . RsaHelper . CreateSecurityKeyFromPublicKey ( secret . PublicKey ) ;
1416 var validationParameters = new TokenValidationParameters
1517 {
1618 ValidateIssuer = false ,
@@ -21,16 +23,18 @@ public static IServiceCollection AddJwtAuthentication(this IServiceCollection se
2123 ClockSkew = TimeSpan . Zero
2224 } ;
2325
24- services . AddAuthentication ( options =>
26+ var builder = services . AddAuthentication ( options =>
2527 {
2628 options . DefaultAuthenticateScheme = JwtBearerDefaults . AuthenticationScheme ;
2729 options . DefaultChallengeScheme = JwtBearerDefaults . AuthenticationScheme ;
28- } )
29- . AddJwtBearer ( options =>
30+ } ) ;
31+
32+ builder . AddJwtBearer ( options =>
3033 {
3134 options . TokenValidationParameters = validationParameters ;
3235 options . RequireHttpsMetadata = false ;
3336 options . SaveToken = true ;
37+ options . Events = Authentication . Events ;
3438 } ) ;
3539
3640 return services ;
You can’t perform that action at this time.
0 commit comments