Skip to content

Commit 7a1db7e

Browse files
committed
Add option for custom http client handler in EntityDescriptor.
1 parent 9f065d1 commit 7a1db7e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/ITfoxtec.Identity.Saml2/Schemas/Metadata/EntityDescriptor.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,15 @@ public async virtual Task<EntityDescriptor> ReadIdPSsoDescriptorFromUrlAsync(
235235
#else
236236
HttpClient httpClient,
237237
# endif
238-
Uri idPMetadataUrl, CancellationToken? cancellationToken = null)
239-
{
238+
Uri idPMetadataUrl, CancellationToken? cancellationToken = null
240239
#if NET || NETCORE
241-
var httpClient = httpClientFactory.CreateClient();
240+
, string httpClientName = null)
241+
{
242+
var httpClient = string.IsNullOrEmpty(httpClientName) ? httpClientFactory.CreateClient() : httpClientFactory.CreateClient(httpClientName);
243+
#else
244+
)
245+
{
242246
#endif
243-
244247
using (var response = cancellationToken.HasValue ? await httpClient.GetAsync(idPMetadataUrl, cancellationToken.Value) : await httpClient.GetAsync(idPMetadataUrl))
245248
{
246249
// Handle the response
@@ -279,12 +282,15 @@ public async virtual Task<EntityDescriptor> ReadSPSsoDescriptorFromUrlAsync(
279282
#else
280283
HttpClient httpClient,
281284
# endif
282-
Uri spMetadataUrl, CancellationToken? cancellationToken = null)
283-
{
285+
Uri spMetadataUrl, CancellationToken? cancellationToken = null
284286
#if NET || NETCORE
285-
var httpClient = httpClientFactory.CreateClient();
287+
, string httpClientName = null)
288+
{
289+
var httpClient = string.IsNullOrEmpty(httpClientName) ? httpClientFactory.CreateClient() : httpClientFactory.CreateClient(httpClientName);
290+
#else
291+
)
292+
{
286293
#endif
287-
288294
using (var response = cancellationToken.HasValue ? await httpClient.GetAsync(spMetadataUrl, cancellationToken.Value) : await httpClient.GetAsync(spMetadataUrl))
289295
{
290296
// Handle the response

0 commit comments

Comments
 (0)