Skip to content

Commit

Permalink
Remove unused code.
Browse files Browse the repository at this point in the history
  • Loading branch information
damianh committed Feb 22, 2025
1 parent 11bac4a commit 8d23759
Showing 1 changed file with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,11 @@ public static void SetDPoPProofToken(this HttpRequestMessage request, string? pr
/// </summary>
public static string? GetDPoPNonce(this HttpResponseMessage response)
{
return response.Headers
.FirstOrDefault(x => string.Equals(OidcConstants.HttpHeaders.DPoPNonce, x.Key, StringComparison.OrdinalIgnoreCase))
.Value?.FirstOrDefault();
return response.Headers.TryGetValues(OidcConstants.HttpHeaders.DPoPNonce, out var values)
? values.FirstOrDefault()
: null;
}

///// <summary>
///// Reads the WWW-Authenticate response header to determine if the respone is in error due to DPoP
///// </summary>
//public static bool IsDPoPError(this HttpResponseMessage response)
//{
// if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
// {
// var header = response.Headers.WwwAuthenticate.Where(x => x.Scheme == OidcConstants.AuthenticationSchemes.AuthorizationHeaderDPoP).FirstOrDefault();
// if (header != null && header.Parameter != null)
// {
// // WWW-Authenticate: DPoP error="use_dpop_nonce"
// var values = header.Parameter.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
// var error = values.Select(x =>
// {
// var parts = x.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
// if (parts.Length == 2 && parts[0] == OidcConstants.TokenResponse.Error)
// {
// return parts[1].Trim('"');
// }
// return null;
// }).Where(x => x != null).FirstOrDefault();

// return error == OidcConstants.TokenErrors.UseDPoPNonce || error == OidcConstants.TokenErrors.InvalidDPoPProof;
// }
// }

// return false;
//}

/// <summary>
/// Returns the URL without any query params
/// </summary>
Expand Down

0 comments on commit 8d23759

Please sign in to comment.