@@ -33,20 +33,23 @@ public void ConfigureServices(IServiceCollection services)
33
33
34
34
// Comment above lines of code and uncomment this section if you would like to validate ID tokens for allowed tenantIds
35
35
//services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
36
- // .AddProtectedWebApi(options => {
37
- // Configuration.Bind("AzureAd", options);
38
- // options.Events = new JwtBearerEvents();
39
- // options.Events.OnTokenValidated = async context=>{
40
- // string[] allowedTenants = { /* list of tenant IDs */ };
41
- // string tenantId = context.Principal.Claims.FirstOrDefault(x => x.Type == "tid" || x.Type == "http://schemas.microsoft.com/identity/claims/tenantid")?.Value;
36
+ // .AddMicrosoftWebApi(options =>
37
+ //{
38
+ // Configuration.Bind("AzureAd", options);
39
+ // options.Events = new JwtBearerEvents();
40
+ // options.Events.OnTokenValidated = async context =>
41
+ // {
42
+ // string[] allowedTenants = {/* list of tenant IDs */ };
43
+ // string tenantId = context.Principal.Claims.FirstOrDefault(x => x.Type == "tid" || x.Type == "http://schemas.microsoft.com/identity/claims/tenantid")?.Value;
42
44
43
- // if (!allowedTenants.Contains(tenantId))
44
- // {
45
- // throw new Exception("This tenant is not authorized");
46
- // }
47
- // };
48
- // },
49
- // options => { Configuration.Bind("AzureAd", options); });
45
+ // if (!allowedTenants.Contains(tenantId))
46
+ // {
47
+ // throw new Exception("This tenant is not authorized");
48
+ // }
49
+ // };
50
+ //}, options => { Configuration.Bind("AzureAd", options); })
51
+ // .AddMicrosoftWebApiCallsWebApi(Configuration)
52
+ // .AddInMemoryTokenCaches();
50
53
51
54
// Creating policies that wraps the authorization requirements
52
55
services . AddAuthorization ( ) ;
0 commit comments