#### [Abblix\.Oidc\.Server](https://www.abblix.com/docs/api/abblix-oidc-server 'index')
### [Abblix\.Oidc\.Server\.Features\.SecureHttpFetch](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.SecureHttpFetch 'Abblix\.Oidc\.Server\.Features\.SecureHttpFetch')

## SecureHttpFetcherExtensions Class

Provides reusable functionality for fetching JSON Web Key Sets \(JWKS\) from remote URIs
with SSRF protection and consistent error handling\.

```csharp
public static class SecureHttpFetcherExtensions
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → SecureHttpFetcherExtensions
### Methods

## SecureHttpFetcherExtensions\.FetchKeysAsync\(this ISecureHttpFetcher, Uri, ILogger, string, string\) Method {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.FetchKeysAsync(thisAbblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string)}

Fetches JSON Web Keys from a JWKS URI with SSRF protection and optional filtering\.

```csharp
public static System.Collections.Generic.IAsyncEnumerable<Abblix.Jwt.JsonWebKey> FetchKeysAsync(this Abblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher secureFetcher, System.Uri jwksUri, Microsoft.Extensions.Logging.ILogger logger, string entityId, string entityType);
```
#### Parameters

###### `secureFetcher` [ISecureHttpFetcher](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher 'Abblix\.Oidc\.Server\.Features\.SecureHttpFetch\.ISecureHttpFetcher') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.FetchKeysAsync(thisAbblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).secureFetcher}

HTTP fetcher with SSRF protection and caching\.

###### `jwksUri` [System\.Uri](https://learn.microsoft.com/en-us/dotnet/api/system.uri 'System\.Uri') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.FetchKeysAsync(thisAbblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).jwksUri}

The URI to fetch the JWKS from\.

###### `logger` [Microsoft\.Extensions\.Logging\.ILogger](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.ilogger 'Microsoft\.Extensions\.Logging\.ILogger') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.FetchKeysAsync(thisAbblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).logger}

Logger for recording fetch operations and errors\.

###### `entityId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.FetchKeysAsync(thisAbblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).entityId}

The identifier of the entity \(client ID or issuer\) for logging\.

###### `entityType` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.FetchKeysAsync(thisAbblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).entityType}

The type of entity \(e\.g\., "client" or "issuer"\) for logging\.

#### Returns
[System\.Collections\.Generic\.IAsyncEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1 'System\.Collections\.Generic\.IAsyncEnumerable\`1')[JsonWebKey](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.JsonWebKey 'Abblix\.Jwt\.JsonWebKey')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1 'System\.Collections\.Generic\.IAsyncEnumerable\`1')  
An async enumerable of JSON Web Keys from the JWKS endpoint\.
Returns empty if fetching fails or the JWKS is invalid\.

## SecureHttpFetcherExtensions\.ResolveKeysAsync\(this IServiceProvider, JsonWebKeySet, Uri, ILogger, string, string\) Method {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.ResolveKeysAsync(thisSystem.IServiceProvider,Abblix.Jwt.JsonWebKeySet,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string)}

Resolves the keys a party publishes, in the two forms a party may publish them: inline in its
registration, and at a JWKS URI\. Both may be present, and the inline keys come first\.

```csharp
public static System.Collections.Generic.IAsyncEnumerable<Abblix.Jwt.JsonWebKey> ResolveKeysAsync(this System.IServiceProvider serviceProvider, Abblix.Jwt.JsonWebKeySet? jwks, System.Uri? jwksUri, Microsoft.Extensions.Logging.ILogger logger, string entityId, string entityType);
```
#### Parameters

###### `serviceProvider` [System\.IServiceProvider](https://learn.microsoft.com/en-us/dotnet/api/system.iserviceprovider 'System\.IServiceProvider') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.ResolveKeysAsync(thisSystem.IServiceProvider,Abblix.Jwt.JsonWebKeySet,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).serviceProvider}

Used to resolve [ISecureHttpFetcher](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher 'Abblix\.Oidc\.Server\.Features\.SecureHttpFetch\.ISecureHttpFetcher'), which is scoped while
            the providers calling this are not, so a scope is created per call rather than held\.

###### `jwks` [JsonWebKeySet](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.JsonWebKeySet 'Abblix\.Jwt\.JsonWebKeySet') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.ResolveKeysAsync(thisSystem.IServiceProvider,Abblix.Jwt.JsonWebKeySet,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).jwks}

The key set held in the party's own registration, if any\.

###### `jwksUri` [System\.Uri](https://learn.microsoft.com/en-us/dotnet/api/system.uri 'System\.Uri') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.ResolveKeysAsync(thisSystem.IServiceProvider,Abblix.Jwt.JsonWebKeySet,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).jwksUri}

The URI the party publishes its key set at, if any\.

###### `logger` [Microsoft\.Extensions\.Logging\.ILogger](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.ilogger 'Microsoft\.Extensions\.Logging\.ILogger') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.ResolveKeysAsync(thisSystem.IServiceProvider,Abblix.Jwt.JsonWebKeySet,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).logger}

Logger for recording fetch operations and errors\.

###### `entityId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.ResolveKeysAsync(thisSystem.IServiceProvider,Abblix.Jwt.JsonWebKeySet,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).entityId}

The identifier of the party, for logging\.

###### `entityType` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Oidc.Server.Features.SecureHttpFetch.SecureHttpFetcherExtensions.ResolveKeysAsync(thisSystem.IServiceProvider,Abblix.Jwt.JsonWebKeySet,System.Uri,Microsoft.Extensions.Logging.ILogger,string,string).entityType}

What kind of party it is\. Must be a value from [KeySetOwners](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.SecureHttpFetch.KeySetOwners 'Abblix\.Oidc\.Server\.Features\.SecureHttpFetch\.KeySetOwners'):
            besides labelling the log, it is the service key under which this consumer's cached fetcher is
            registered, so the same value selects the cache lifetime that consumer was given\.

#### Returns
[System\.Collections\.Generic\.IAsyncEnumerable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1 'System\.Collections\.Generic\.IAsyncEnumerable\`1')[JsonWebKey](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.JsonWebKey 'Abblix\.Jwt\.JsonWebKey')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1 'System\.Collections\.Generic\.IAsyncEnumerable\`1')  
The inline keys followed by the fetched ones\. Empty when the party declares neither\.

### Remarks
The fetch itself is SSRF\-protected and cached by the decorators around [ISecureHttpFetcher](https://www.abblix.com/docs/api/abblix-oidc-server/Abblix.Oidc.Server.Features.SecureHttpFetch.ISecureHttpFetcher 'Abblix\.Oidc\.Server\.Features\.SecureHttpFetch\.ISecureHttpFetcher'),
so a caller gets both without arranging either\.
