Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to only use the code to create the authorization header? #1227

Open
JobaDiniz opened this issue Dec 23, 2024 · 3 comments
Open

how to only use the code to create the authorization header? #1227

JobaDiniz opened this issue Dec 23, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@JobaDiniz
Copy link

Is your feature request related to a problem? Please describe.

The lib is nice, but I don't want to use the SendAsync(...) extension because I have different code that builds the request and then I call SendAsync (official). I just want to sign the request, adding the needed headers etc, without having to call SendAsync.

How can I do that? The code is probably there already.

@JobaDiniz JobaDiniz added the enhancement New feature or request label Dec 23, 2024
Copy link
Contributor

Hi there and welcome to this repository!

A maintainer will be with you shortly, but first and foremost I would like to thank you for taking the time to report this issue. Quality is of the highest priority for us, and we would never release anything with known defects. We aim to do our best but unfortunately you are here because you encountered something we didn't expect. Lets see if we can figure out what went wrong and provide a remedy for it.

@mungojam
Copy link
Contributor

I wonder if that can be done with an extension method addition to the httpclientfactory setup during app initialisation. It would be a nice addition. Similar to how the MS resiliency stuff is done

@JobaDiniz
Copy link
Author

Fortunately the library exposed the class that is required to sign:

var credentials = ...
var request = new HttpRequestMessage(...);
 _ = await Signer.SignAsync(request, null, request.Headers, DateTime.UtcNow, "us-west-2", "lambda", credentials.GetCredentials());
 var response = await client.SendAsync(request, cancellation);

another point is that the library deliberately assumes the headers is on the DefaultHttpRequestHeaders property, but in my case I'm using the request.Headers and not the client.Default.. headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants