From 3f85811361e404ae14aaa22168ccb60d1ffe5e36 Mon Sep 17 00:00:00 2001 From: HarelM Date: Sun, 12 Jan 2025 09:57:23 +0200 Subject: [PATCH 1/2] Remove OAuth1.0 --- OsmSharp.IO.API/ClientsFactory.cs | 6 --- OsmSharp.IO.API/IClientsFactory.cs | 9 ----- OsmSharp.IO.API/OAuthClient.cs | 53 -------------------------- OsmSharp.IO.API/OsmSharp.IO.API.csproj | 3 +- 4 files changed, 1 insertion(+), 70 deletions(-) delete mode 100644 OsmSharp.IO.API/OAuthClient.cs diff --git a/OsmSharp.IO.API/ClientsFactory.cs b/OsmSharp.IO.API/ClientsFactory.cs index 4f36d12..04abf8f 100644 --- a/OsmSharp.IO.API/ClientsFactory.cs +++ b/OsmSharp.IO.API/ClientsFactory.cs @@ -42,12 +42,6 @@ public IAuthClient CreateBasicAuthClient(string username, string password) return new BasicAuthClient(_httpClient, _logger, _baseAddress, username, password); } - /// - public IAuthClient CreateOAuthClient(string consumerKey, string consumerSecret, string token, string tokenSecret) - { - return new OAuthClient(_httpClient, _logger, _baseAddress, consumerKey, consumerSecret, token, tokenSecret); - } - /// public IAuthClient CreateOAuth2Client(string token) { diff --git a/OsmSharp.IO.API/IClientsFactory.cs b/OsmSharp.IO.API/IClientsFactory.cs index bbcf96c..55c50b1 100644 --- a/OsmSharp.IO.API/IClientsFactory.cs +++ b/OsmSharp.IO.API/IClientsFactory.cs @@ -18,15 +18,6 @@ public interface IClientsFactory /// /// IAuthClient CreateBasicAuthClient(string username, string password); - /// - /// Creates a client that will use OAuth 1.0 credentials provided from the OAuth OSM page - /// - /// - /// - /// - /// - /// - IAuthClient CreateOAuthClient(string consumerKey, string consumerSecret, string token, string tokenSecret); /// /// Creates a client that will use OAuth 2.0 credentials provided from the OAuth OSM page diff --git a/OsmSharp.IO.API/OAuthClient.cs b/OsmSharp.IO.API/OAuthClient.cs deleted file mode 100644 index 8e8a887..0000000 --- a/OsmSharp.IO.API/OAuthClient.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Microsoft.Extensions.Logging; -using System; -using System.Net.Http; - -namespace OsmSharp.IO.API -{ - public class OAuthClient : AuthClient - { - /// - /// The OSM consumer key that was generated from OSM site - /// - private readonly string ConsumerKey; - /// - /// The OSM consumer secret that was generated from OSM site - /// - private readonly string ConsumerSecret; - private readonly string Token; - private readonly string TokenSecret; - - public OAuthClient(HttpClient httpClient, - ILogger logger, - string baseAddress, - string consumerKey, - string consumerSecret, - string token, - string tokenSecret) - : base (baseAddress, httpClient, logger) - { - ConsumerKey = consumerKey; - ConsumerSecret = consumerSecret; - Token = token; - TokenSecret = tokenSecret; - } - - protected override void AddAuthentication(HttpRequestMessage message, string url, string method = "GET") - { - var request = new OAuth.OAuthRequest - { - ConsumerKey = ConsumerKey, - ConsumerSecret = ConsumerSecret, - Token = Token, - TokenSecret = TokenSecret, - Type = OAuth.OAuthRequestType.ProtectedResource, - SignatureMethod = OAuth.OAuthSignatureMethod.HmacSha1, - RequestUrl = url, - Version = "1.0", - Method = method - }; - var auth = request.GetAuthorizationHeader().Replace("OAuth ", ""); - message.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("OAuth", auth); - } - } -} \ No newline at end of file diff --git a/OsmSharp.IO.API/OsmSharp.IO.API.csproj b/OsmSharp.IO.API/OsmSharp.IO.API.csproj index 6dc65da..25bbb9d 100644 --- a/OsmSharp.IO.API/OsmSharp.IO.API.csproj +++ b/OsmSharp.IO.API/OsmSharp.IO.API.csproj @@ -24,14 +24,13 @@ - + - From 325a9e6bbcefda15a7be6e3a4bf802d9dd1343c1 Mon Sep 17 00:00:00 2001 From: HarelM Date: Sun, 12 Jan 2025 11:29:56 +0200 Subject: [PATCH 2/2] Update tests to use .net 8 --- OsmSharp.IO.API.Tests/OsmSharp.IO.API.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmSharp.IO.API.Tests/OsmSharp.IO.API.Tests.csproj b/OsmSharp.IO.API.Tests/OsmSharp.IO.API.Tests.csproj index a4b111a..132ecfb 100644 --- a/OsmSharp.IO.API.Tests/OsmSharp.IO.API.Tests.csproj +++ b/OsmSharp.IO.API.Tests/OsmSharp.IO.API.Tests.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 false