Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public interface IDPopHttpClient
{
internal Task<DPopHttpResponse> Post(
Uri requestUri,
HttpContent content,
DPopConfig config);
DPopConfig config,
Func<HttpContent> getContent);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public DPopHttpClient(

public async Task<DPopHttpResponse> Post(
Uri requestUri,
HttpContent content,
DPopConfig config)
DPopConfig config,
Func<HttpContent> getContent)
{
var dPop = await _keyStore.GenerateDPopProofOfPossessionAsync(
config.KeyId,
Expand All @@ -44,9 +44,7 @@ public async Task<DPopHttpResponse> Post(
token => _httpClient.WithDPopHeader(dPop).WithAuthorizationHeader(token),
() => _httpClient.WithDPopHeader(dPop));

var response = await httpClient.PostAsync(
requestUri,
content);
var response = await httpClient.PostAsync(requestUri, getContent());

await ThrowIfInvalidGrantError(response);

Expand All @@ -63,7 +61,7 @@ public async Task<DPopHttpResponse> Post(

httpClient.WithDPopHeader(newDpop);

response = await httpClient.PostAsync(requestUri, content);
response = await httpClient.PostAsync(requestUri, getContent());
}

await ThrowIfInvalidGrantError(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public async Task<OneOf<OAuthToken, DPopToken>> RequestToken(

var result = await _dPopHttpClient.Post(
uri,
tokenRequest.ToFormUrlEncoded(),
config);
config,
tokenRequest.ToFormUrlEncoded);

var token = DeserializeObject<OAuthToken>(await result.ResponseMessage.Content.ReadAsStringAsync())
?? throw new InvalidOperationException("Failed to deserialize the token response");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async Task<Validation<CredentialResponse>> ICredentialRequestService.RequestCred
clientOptions);

var result = new MdocCredentialRequest(vciRequest, mdoc);
return result.AsJson();
return result.EncodeToJson();
}
);

Expand All @@ -121,8 +121,8 @@ async Task<Validation<CredentialResponse>> ICredentialRequestService.RequestCred

var dPopResponse = await _dPopHttpClient.Post(
issuerMetadata.CredentialEndpoint,
content,
config);
config,
() => content);

return dPopResponse.ResponseMessage;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public MdocCredentialRequest(CredentialRequest credentialRequest, MdocConfigurat

public static class MdocCredentialRequestFun
{
public static string AsJson(this MdocCredentialRequest request)
public static string EncodeToJson(this MdocCredentialRequest request)
{
var json = request.VciRequest.EncodeToJson();

Expand Down
Loading