File tree Expand file tree Collapse file tree
Packages/Federation.Sdk/Source Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ public sealed record FederationOptions
66 public string ClientSecret { get ; set ; } = default ! ;
77 public string Realm { get ; set ; } = default ! ;
88 public string Authority { get ; set ; } = default ! ;
9- }
9+ public string [ ] Audiences { get ; set ; } = [ ] ;
10+ }
Original file line number Diff line number Diff line change @@ -11,8 +11,17 @@ public static void AddBearerAuthentication(this IServiceCollection services)
1111 . AddJwtBearer ( configuration =>
1212 {
1313 configuration . Authority = options . Authority ;
14- configuration . Audience = options . Realm ;
1514 configuration . RequireHttpsMetadata = false ;
15+ configuration . TokenValidationParameters = new TokenValidationParameters
16+ {
17+ ValidateIssuer = true ,
18+ ValidateAudience = true ,
19+
20+ // https://www.rfc-editor.org/rfc/rfc7519.html?#section-4.1.3
21+ // supports multiple audiences in the "aud" claim, so we need to check if any of the audiences match
22+ ValidIssuer = options . Authority ,
23+ ValidAudiences = options . Audiences
24+ } ;
1625 } ) ;
1726 }
18- }
27+ }
You can’t perform that action at this time.
0 commit comments