Skip to content

Commit

Permalink
auth
Browse files Browse the repository at this point in the history
  • Loading branch information
wrutkowski-xebia committed Apr 15, 2024
1 parent 583bd2c commit d139cc6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ public async Task<string> GetCustomersAsync()
}
public async Task<string> GetProductsAsync()
{
return await httpClient.GetStringAsync("Product");
var request = new HttpRequestMessage(HttpMethod.Get, "Product");
request.Headers.Add("X-MS-API-ROLE", "Sample.Role");
//request.Headers.Add("X-MS-API-ROLE", "authenticated");


var response = await httpClient.SendAsync(request);
return await response.Content.ReadAsStringAsync();


//return await httpClient.GetStringAsync("Product");
}
}
}
1 change: 1 addition & 0 deletions src/SingleWebApplication/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{
options.ProviderOptions.LoginMode = "redirect";
builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication);
options.UserOptions.RoleClaim = "Sample.Role";
});

builder.Services.AddHttpClients(builder.Configuration);
Expand Down

0 comments on commit d139cc6

Please sign in to comment.