From 7f96705a9effde36f2dacb1032419a2d1e75bb51 Mon Sep 17 00:00:00 2001 From: Roland Guijt Date: Thu, 14 Nov 2024 10:57:24 +0100 Subject: [PATCH] Remove unneeded code --- .../v7/DPoP/WebClient/CustomProofService.cs | 26 ----------------- .../v7/DPoP/WebClient/TestHandler.cs | 28 ------------------- 2 files changed, 54 deletions(-) delete mode 100644 IdentityServer/v7/DPoP/WebClient/CustomProofService.cs delete mode 100644 IdentityServer/v7/DPoP/WebClient/TestHandler.cs diff --git a/IdentityServer/v7/DPoP/WebClient/CustomProofService.cs b/IdentityServer/v7/DPoP/WebClient/CustomProofService.cs deleted file mode 100644 index 104e3ccb..00000000 --- a/IdentityServer/v7/DPoP/WebClient/CustomProofService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Duende.AccessTokenManagement; - -namespace WebClient; - -public class CustomProofService : DefaultDPoPProofService, IDPoPProofService -{ - public CustomProofService(IDPoPNonceStore dPoPNonceStore, ILogger logger) : base(dPoPNonceStore, logger) - { - } - - public new Task CreateProofTokenAsync(DPoPProofRequest request) - { - if (request.Url.StartsWith("https://localhost:5005")) - { - // this shows how you can prevent DPoP from being used at an API endpoint - // and this will cause the request to send the same token with the Bearer scheme - //return Task.FromResult(null); - } - return base.CreateProofTokenAsync(request); - } - - public new string GetProofKeyThumbprint(DPoPProofRequest request) - { - return base.GetProofKeyThumbprint(request); - } -} diff --git a/IdentityServer/v7/DPoP/WebClient/TestHandler.cs b/IdentityServer/v7/DPoP/WebClient/TestHandler.cs deleted file mode 100644 index 193f9359..00000000 --- a/IdentityServer/v7/DPoP/WebClient/TestHandler.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace WebClient; - -public class TestHandler : DelegatingHandler -{ - private readonly ILogger _logger; - - public TestHandler(ILogger logger) - { - _logger = logger; - } - protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - var response = await base.SendAsync(request, cancellationToken); - if (response.Headers.Contains("WWW-Authenticate")) - { - foreach(var value in response.Headers.WwwAuthenticate) - { - _logger.LogInformation("Response from API {url}, WWW-Authenticate: {header}", request.RequestUri.AbsoluteUri, value.ToString()); - } - } - if (response.Headers.TryGetValues("DPoP-Nonce", out var header)) - { - var nonce = header.First().ToString(); - _logger.LogInformation("Response from API {url}, nonce: {nonce}", request.RequestUri.AbsoluteUri, nonce); - } - return response; - } -}