An HttpClient service for IdentityServer4
An HttpClient service that makes it easy to make authenticated HTTP requests to protected by IdentityServer4 resources. Complex types are automatically serialized for requests / deserialized for responses, all with a fluent interface design:
var responseObject = await _requestServiceFactory //Create a instance of the service .CreateHttpClientService() //Supports many ways of setting IdentityServer options .SetIdentityServerOptions("ClientCredentialsOptions") //GET and deserialize the response body to IEnumerable<Customers> .GetAsync<IEnumerable<Customers>>("https://api/customers");
Check the Getting started guide for more details!
Getting started with IdentityServer4.Contrib.HttpClientService is easy; you only need three things:
- Install the nuget package IdentityServer4.Contrib.HttpClientService
- Provide the options to request an access token in the
- Register the service in
Read the 'More Details' section for a more detailed explanation on some of the features of this library, like the
SetIdentityServerOptions overloads, the
ResponseObject and the
TypeContent(TRequestBody, Encoding, string) class
Feedback and contibution is more than welcome, as there are many more things to do!
Just as a sample:
- Expand the IdentityServer4.Contrib.HttpClientService.CompleteSample with more functionality.
- Support more than
- Set options for changing the x-header name
- Add logging.
Many more are coming soon and all of them should be issues, so feel free to open one and let's start discussing solutions!