From c750b72e4f2631ee0d66fe7dcf119e7b2e4f2fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=B6lts?= Date: Fri, 21 Jun 2024 08:37:00 +0200 Subject: [PATCH 1/2] Updated dependencies --- CHANGELOG.md | 7 + KeeAnywhere.sln | 12 +- KeeAnywhere/KeeAnywhere.csproj | 329 +++++++++++------- KeeAnywhere/KeeAnywhereExt.cs | 10 +- KeeAnywhere/OAuth2/OidcFlow.cs | 4 +- KeeAnywhere/OAuth2/OidcSystemBrowser.cs | 14 +- KeeAnywhere/PluginResources.Designer.cs | 8 +- .../Azure/AzureResources.Designer.cs | 2 +- .../Box/BoxStorageProvider.cs | 2 +- .../OneDrive/OneDriveApiExtensions.cs | 13 +- .../OneDriveAuthenticationProvider.cs | 15 +- .../OneDrive/OneDriveHelper.cs | 23 +- .../OneDrive/OneDriveStorageProvider.cs | 33 +- KeeAnywhere/app.config | 92 ++++- KeeAnywhere/packages.config | 158 +++++---- chocolatey/keepass-plugin-keeanywhere.nuspec | 2 +- 16 files changed, 464 insertions(+), 260 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91bafcc..b927ea1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2.2.0 (unrelease) + +### Improved + +- Updated Dependencies (AWS, Box, Dropbox, Google Drive, Google Storage, OneDrive) +- Using .Net 4.8 now + ## 2.1.0 (2024-06-17) ### New diff --git a/KeeAnywhere.sln b/KeeAnywhere.sln index 286c94a..ea1c359 100644 --- a/KeeAnywhere.sln +++ b/KeeAnywhere.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34728.123 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeeAnywhere", "KeeAnywhere\KeeAnywhere.csproj", "{8E40EDF5-06B8-4059-8B19-CB90D937FEBB}" EndProject @@ -25,6 +25,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{4CC0AA8D-734 version_manifest.txt = version_manifest.txt EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Chocolatey", "Chocolatey", "{93E4E5BD-9206-4479-AC34-BEDDD9D37DC9}" + ProjectSection(SolutionItems) = preProject + chocolatey\keepass-plugin-keeanywhere.nuspec = chocolatey\keepass-plugin-keeanywhere.nuspec + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,4 +44,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {79A52A20-6395-4845-937E-CCFD13C162E0} + EndGlobalSection EndGlobal diff --git a/KeeAnywhere/KeeAnywhere.csproj b/KeeAnywhere/KeeAnywhere.csproj index 3ed5f32..b2e6f55 100644 --- a/KeeAnywhere/KeeAnywhere.csproj +++ b/KeeAnywhere/KeeAnywhere.csproj @@ -9,7 +9,7 @@ Properties KeeAnywhere KeeAnywhere - v4.6.1 + v4.8 512 @@ -41,61 +41,58 @@ - ..\packages\AWSSDK.Core.3.5.2.5\lib\net45\AWSSDK.Core.dll + ..\packages\AWSSDK.Core.3.7.304.17\lib\net45\AWSSDK.Core.dll - ..\packages\AWSSDK.S3.3.5.8\lib\net45\AWSSDK.S3.dll + ..\packages\AWSSDK.S3.3.7.309.5\lib\net45\AWSSDK.S3.dll - - ..\packages\BouncyCastle.1.8.9\lib\BouncyCastle.Crypto.dll + + ..\packages\Azure.Core.1.40.0\lib\net472\Azure.Core.dll + + + ..\packages\BouncyCastle.Cryptography.2.4.0\lib\net461\BouncyCastle.Cryptography.dll ..\packages\BouncyCastle-PCL.1.0.0.6\lib\bouncy_castle_hmac_sha_pcl.dll - ..\packages\Box.V2.3.25.0\lib\net45\Box.V2.dll + ..\packages\Box.V2.5.7.0\lib\net462\Box.V2.dll ..\packages\CredentialManagement.1.0.2\lib\net35\CredentialManagement.dll - - ..\packages\Dropbox.Api.6.6.0\lib\netstandard2.0\Dropbox.Api.dll - - - ..\packages\Google.Api.Gax.3.2.0\lib\net461\Google.Api.Gax.dll + + ..\packages\Dropbox.Api.7.0.0\lib\netstandard2.0\Dropbox.Api.dll - - ..\packages\Google.Api.Gax.Rest.3.2.0\lib\net461\Google.Api.Gax.Rest.dll + + ..\packages\Google.Api.Gax.4.8.0\lib\net462\Google.Api.Gax.dll - - ..\packages\Google.Apis.1.49.0\lib\net45\Google.Apis.dll + + ..\packages\Google.Api.Gax.Rest.4.8.0\lib\net462\Google.Api.Gax.Rest.dll - - ..\packages\Google.Apis.Auth.1.49.0\lib\net45\Google.Apis.Auth.dll + + ..\packages\Google.Apis.1.68.0\lib\net462\Google.Apis.dll - - ..\packages\Google.Apis.Auth.1.49.0\lib\net45\Google.Apis.Auth.PlatformServices.dll + + ..\packages\Google.Apis.Auth.1.68.0\lib\net462\Google.Apis.Auth.dll - - ..\packages\Google.Apis.Core.1.49.0\lib\net45\Google.Apis.Core.dll + + ..\packages\Google.Apis.Core.1.68.0\lib\net462\Google.Apis.Core.dll - - ..\packages\Google.Apis.Drive.v3.1.49.0.2201\lib\net45\Google.Apis.Drive.v3.dll + + ..\packages\Google.Apis.Drive.v3.1.68.0.3428\lib\net462\Google.Apis.Drive.v3.dll - - ..\packages\Google.Apis.1.49.0\lib\net45\Google.Apis.PlatformServices.dll + + ..\packages\Google.Apis.Storage.v1.1.68.0.3431\lib\net462\Google.Apis.Storage.v1.dll - - ..\packages\Google.Apis.Storage.v1.1.49.0.2151\lib\net45\Google.Apis.Storage.v1.dll + + ..\packages\Google.Cloud.Storage.V1.4.10.0\lib\net462\Google.Cloud.Storage.V1.dll - - ..\packages\Google.Cloud.Storage.V1.3.4.0\lib\net461\Google.Cloud.Storage.V1.dll + + ..\packages\IdentityModel.7.0.0\lib\net472\IdentityModel.dll - - ..\packages\IdentityModel.4.1.0\lib\net461\IdentityModel.dll - - - ..\packages\IdentityModel.OidcClient.3.1.2\lib\net461\IdentityModel.OidcClient.dll + + ..\packages\IdentityModel.OidcClient.6.0.0\lib\netstandard2.0\IdentityModel.OidcClient.dll False @@ -104,77 +101,106 @@ ..\packages\Kyrodan.HiDriveSDK.0.2.0\lib\portable45-net45+win8+wpa81\Kyrodan.HiDrive.dll - - ..\packages\log4net.2.0.12\lib\net45\log4net.dll + + ..\packages\log4net.2.0.17\lib\net45\log4net.dll - - ..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + + ..\packages\Microsoft.Azure.KeyVault.Core.3.0.5\lib\net461\Microsoft.Azure.KeyVault.Core.dll - - ..\packages\Microsoft.Azure.Storage.Blob.11.2.2\lib\net452\Microsoft.Azure.Storage.Blob.dll + + ..\packages\Microsoft.Azure.Storage.Blob.11.2.3\lib\net452\Microsoft.Azure.Storage.Blob.dll - - ..\packages\Microsoft.Azure.Storage.Common.11.2.2\lib\net452\Microsoft.Azure.Storage.Common.dll + + ..\packages\Microsoft.Azure.Storage.Common.11.2.3\lib\net452\Microsoft.Azure.Storage.Common.dll - - ..\packages\Microsoft.Azure.Storage.File.11.2.2\lib\net452\Microsoft.Azure.Storage.File.dll + + ..\packages\Microsoft.Azure.Storage.File.11.2.3\lib\net452\Microsoft.Azure.Storage.File.dll - - ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll - True + + ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + - - ..\packages\Microsoft.Extensions.Configuration.2.1.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll + + ..\packages\Microsoft.Extensions.Configuration.8.0.0\lib\net462\Microsoft.Extensions.Configuration.dll - - ..\packages\Microsoft.Extensions.Configuration.Abstractions.2.1.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll + + ..\packages\Microsoft.Extensions.Configuration.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Configuration.Abstractions.dll - - ..\packages\Microsoft.Extensions.Configuration.Binder.2.1.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll + + ..\packages\Microsoft.Extensions.Configuration.Binder.8.0.1\lib\net462\Microsoft.Extensions.Configuration.Binder.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.1.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.8.0.0\lib\net462\Microsoft.Extensions.DependencyInjection.dll - - ..\packages\Microsoft.Extensions.Logging.2.1.0\lib\netstandard2.0\Microsoft.Extensions.Logging.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - ..\packages\Microsoft.Extensions.Logging.Abstractions.2.1.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll + + ..\packages\Microsoft.Extensions.Logging.8.0.0\lib\net462\Microsoft.Extensions.Logging.dll - - ..\packages\Microsoft.Extensions.Options.2.1.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll + + ..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll - - ..\packages\Microsoft.Extensions.Primitives.2.1.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll + + ..\packages\Microsoft.Extensions.Options.8.0.2\lib\net462\Microsoft.Extensions.Options.dll - - ..\packages\Microsoft.Graph.3.24.0\lib\net461\Microsoft.Graph.dll + + ..\packages\Microsoft.Extensions.Primitives.8.0.0\lib\net462\Microsoft.Extensions.Primitives.dll - - ..\packages\Microsoft.Graph.Core.1.24.0\lib\net45\Microsoft.Graph.Core.dll + + ..\packages\Microsoft.Graph.5.56.0\lib\netstandard2.0\Microsoft.Graph.dll - - ..\packages\Microsoft.IdentityModel.Abstractions.7.6.1\lib\net461\Microsoft.IdentityModel.Abstractions.dll - True + + ..\packages\Microsoft.Graph.Core.3.1.12\lib\net462\Microsoft.Graph.Core.dll - - ..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.22.302111727\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + ..\packages\Microsoft.IdentityModel.Abstractions.7.6.1\lib\net472\Microsoft.IdentityModel.Abstractions.dll - - ..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.22.302111727\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + + ..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.5.3.0\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - - ..\packages\Microsoft.IdentityModel.JsonWebTokens.7.6.1\lib\net461\Microsoft.IdentityModel.JsonWebTokens.dll - True + + ..\packages\Microsoft.IdentityModel.JsonWebTokens.7.6.1\lib\net472\Microsoft.IdentityModel.JsonWebTokens.dll - - ..\packages\Microsoft.IdentityModel.Logging.7.6.1\lib\net461\Microsoft.IdentityModel.Logging.dll - True + + ..\packages\Microsoft.IdentityModel.Logging.7.6.1\lib\net472\Microsoft.IdentityModel.Logging.dll - - ..\packages\Microsoft.IdentityModel.Tokens.7.6.1\lib\net461\Microsoft.IdentityModel.Tokens.dll - True + + ..\packages\Microsoft.IdentityModel.Protocols.7.6.1\lib\net472\Microsoft.IdentityModel.Protocols.dll + + + ..\packages\Microsoft.IdentityModel.Protocols.OpenIdConnect.7.6.1\lib\net472\Microsoft.IdentityModel.Protocols.OpenIdConnect.dll + + + ..\packages\Microsoft.IdentityModel.Tokens.7.6.1\lib\net472\Microsoft.IdentityModel.Tokens.dll + + + ..\packages\Microsoft.Kiota.Abstractions.1.9.6\lib\netstandard2.0\Microsoft.Kiota.Abstractions.dll + + + ..\packages\Microsoft.Kiota.Authentication.Azure.1.1.7\lib\netstandard2.0\Microsoft.Kiota.Authentication.Azure.dll + + + ..\packages\Microsoft.Kiota.Http.HttpClientLibrary.1.4.3\lib\net462\Microsoft.Kiota.Http.HttpClientLibrary.dll + + + ..\packages\Microsoft.Kiota.Serialization.Form.1.2.4\lib\netstandard2.0\Microsoft.Kiota.Serialization.Form.dll + + + ..\packages\Microsoft.Kiota.Serialization.Json.1.3.3\lib\netstandard2.0\Microsoft.Kiota.Serialization.Json.dll + + + ..\packages\Microsoft.Kiota.Serialization.Multipart.1.1.5\lib\netstandard2.0\Microsoft.Kiota.Serialization.Multipart.dll + + + ..\packages\Microsoft.Kiota.Serialization.Text.1.2.2\lib\netstandard2.0\Microsoft.Kiota.Serialization.Text.dll + + + ..\packages\Microsoft.Rest.ClientRuntime.2.3.24\lib\net461\Microsoft.Rest.ClientRuntime.dll + + + ..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.19\lib\net461\Microsoft.Rest.ClientRuntime.Azure.dll ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -185,67 +211,111 @@ ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll - + + ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll - True - - ..\packages\Nito.AsyncEx.2.1.3\lib\net45\Nito.AsyncEx.dll + + ..\packages\Nito.AsyncEx.Context.5.1.2\lib\net461\Nito.AsyncEx.Context.dll - - ..\packages\Nito.AsyncEx.2.1.3\lib\net45\Nito.AsyncEx.Concurrent.dll + + ..\packages\Nito.AsyncEx.Coordination.5.1.2\lib\net461\Nito.AsyncEx.Coordination.dll - - ..\packages\Nito.AsyncEx.2.1.3\lib\net45\Nito.AsyncEx.Enlightenment.dll + + ..\packages\Nito.AsyncEx.Interop.WaitHandles.5.1.2\lib\net461\Nito.AsyncEx.Interop.WaitHandles.dll + + + ..\packages\Nito.AsyncEx.Oop.5.1.2\lib\net461\Nito.AsyncEx.Oop.dll + + + ..\packages\Nito.AsyncEx.Tasks.5.1.2\lib\net461\Nito.AsyncEx.Tasks.dll + + + ..\packages\Nito.Cancellation.1.2.0\lib\net461\Nito.Cancellation.dll + + + ..\packages\Nito.Collections.Deque.1.2.1\lib\net461\Nito.Collections.Deque.dll + + + ..\packages\Nito.Disposables.2.5.0\lib\net461\Nito.Disposables.dll + + + ..\packages\PlgxTool.1.0.3\lib\net40\PlgxTool.exe + + + ..\packages\Std.UriTemplate.1.0.1\lib\netstandard2.0\Std.UriTemplate.dll - ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + ..\packages\System.ClientModel.1.0.0\lib\netstandard2.0\System.ClientModel.dll + + + ..\packages\System.CodeDom.8.0.0\lib\net462\System.CodeDom.dll + + + ..\packages\System.Collections.Immutable.8.0.0\lib\net462\System.Collections.Immutable.dll + + + - - ..\packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll + + + ..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll - - ..\packages\System.IdentityModel.Tokens.Jwt.5.7.0\lib\net461\System.IdentityModel.Tokens.Jwt.dll - True + + + ..\packages\System.IdentityModel.Tokens.Jwt.7.6.1\lib\net472\System.IdentityModel.Tokens.Jwt.dll - - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.IO.dll + + ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + True - + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll - True - - - - ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + ..\packages\System.Memory.Data.8.0.0\lib\net462\System.Memory.Data.dll - - ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + True True - ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll + + ..\packages\System.Net.Http.WinHttpHandler.8.0.0\lib\net462\System.Net.Http.WinHttpHandler.dll + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + - - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Runtime.dll + + ..\packages\System.Runtime.4.3.1\lib\net462\System.Runtime.dll + True + True + + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll - - ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll + + ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net463\System.Security.Cryptography.Algorithms.dll True True @@ -259,34 +329,30 @@ True True - - ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll True True - - ..\packages\System.Text.Encodings.Web.8.0.0\lib\netstandard2.0\System.Text.Encodings.Web.dll - True + + ..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll - - ..\packages\System.Text.Json.8.0.3\lib\netstandard2.0\System.Text.Json.dll - True + + ..\packages\System.Text.Json.8.0.3\lib\net462\System.Text.Json.dll C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Facades\System.Threading.Tasks.dll - + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll - True - - ..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll - True - True + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + ..\packages\Zlib.Portable.Signed.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll @@ -494,9 +560,7 @@ - - Designer - + @@ -512,7 +576,8 @@ - + + @@ -544,7 +609,7 @@ Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - + - + \ No newline at end of file diff --git a/KeeAnywhere/KeeAnywhereExt.cs b/KeeAnywhere/KeeAnywhereExt.cs index 55fad6d..e070b08 100644 --- a/KeeAnywhere/KeeAnywhereExt.cs +++ b/KeeAnywhere/KeeAnywhereExt.cs @@ -263,7 +263,15 @@ private static void FixDependencyLoading() "Microsoft.Graph.Core", "Google.Apis", "Google.Apis.Auth", - "Google.Apis.Core" + "Google.Apis.Core", + "Microsoft.Kiota.Abstractions", + "Microsoft.Bcl.AsyncInterfaces", + "System.Diagnostics.DiagnosticSource", + "System.Text.Json", + "System.Text.Encodings.Web", + "System.Runtime.CompilerServices.Unsafe", + "Microsoft.Extensions.Logging.Abstractions", + "System.Net.Http.WinHttpHandler" // "System.Text.Encodings.Web", // "System.Runtime.CompilerServices.Unsafe" }; diff --git a/KeeAnywhere/OAuth2/OidcFlow.cs b/KeeAnywhere/OAuth2/OidcFlow.cs index 6027233..f6750c0 100644 --- a/KeeAnywhere/OAuth2/OidcFlow.cs +++ b/KeeAnywhere/OAuth2/OidcFlow.cs @@ -107,8 +107,8 @@ private OidcClientOptions CreateBaseOptions() ClientId = m_clientId, ClientSecret = m_clientSecret, Scope = scopes, - Flow = OidcClientOptions.AuthenticationFlow.AuthorizationCode, - ResponseMode = OidcClientOptions.AuthorizeResponseMode.FormPost, + //Flow = OidcClientOptions.AuthenticationFlow.AuthorizationCode, + //ResponseMode = OidcClientOptions.AuthorizeResponseMode.FormPost, RefreshTokenInnerHttpHandler = ProxyTools.CreateHttpClientHandler(), BackchannelHandler = ProxyTools.CreateHttpClientHandler(), LoadProfile = false diff --git a/KeeAnywhere/OAuth2/OidcSystemBrowser.cs b/KeeAnywhere/OAuth2/OidcSystemBrowser.cs index 4a6c79c..f2b57d3 100644 --- a/KeeAnywhere/OAuth2/OidcSystemBrowser.cs +++ b/KeeAnywhere/OAuth2/OidcSystemBrowser.cs @@ -101,14 +101,14 @@ public async Task InvokeAsync(BrowserOptions options, Cancellatio string result; - if (options.ResponseMode == IdentityModel.OidcClient.OidcClientOptions.AuthorizeResponseMode.Redirect) - { + //if (options.ResponseMode == IdentityModel.OidcClient.OidcClientOptions.AuthorizeResponseMode.Redirect) + //{ result = context.Request.Url.Query; - } - else - { - result = ProcessFormPost(context.Request); - } + //} + //else + //{ + // result = ProcessFormPost(context.Request); + //} await SendResponse(context.Response); diff --git a/KeeAnywhere/PluginResources.Designer.cs b/KeeAnywhere/PluginResources.Designer.cs index fe1fc0c..17209d0 100644 --- a/KeeAnywhere/PluginResources.Designer.cs +++ b/KeeAnywhere/PluginResources.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // Dieser Code wurde von einem Tool generiert. // Laufzeitversion:4.0.30319.42000 @@ -19,7 +19,7 @@ namespace KeeAnywhere { // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class PluginResources { @@ -111,7 +111,7 @@ internal static System.Drawing.Bitmap Folder_16x16 { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap GoogleCloudStorage_16x16 { get { @@ -121,7 +121,7 @@ internal static System.Drawing.Bitmap GoogleCloudStorage_16x16 { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap GoogleDrive_16x16 { get { diff --git a/KeeAnywhere/StorageProviders/Azure/AzureResources.Designer.cs b/KeeAnywhere/StorageProviders/Azure/AzureResources.Designer.cs index 7bbef7e..8034b0a 100644 --- a/KeeAnywhere/StorageProviders/Azure/AzureResources.Designer.cs +++ b/KeeAnywhere/StorageProviders/Azure/AzureResources.Designer.cs @@ -19,7 +19,7 @@ namespace KeeAnywhere.StorageProviders.Azure { // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class AzureResources { diff --git a/KeeAnywhere/StorageProviders/Box/BoxStorageProvider.cs b/KeeAnywhere/StorageProviders/Box/BoxStorageProvider.cs index 61cfdbd..8c80a19 100644 --- a/KeeAnywhere/StorageProviders/Box/BoxStorageProvider.cs +++ b/KeeAnywhere/StorageProviders/Box/BoxStorageProvider.cs @@ -27,7 +27,7 @@ public async Task Load(string path) if (item == null) return null; - var stream = await api.FilesManager.DownloadStreamAsync(item.Id); + var stream = await api.FilesManager.DownloadAsync(item.Id); return stream; } diff --git a/KeeAnywhere/StorageProviders/OneDrive/OneDriveApiExtensions.cs b/KeeAnywhere/StorageProviders/OneDrive/OneDriveApiExtensions.cs index f56bcce..c6797f1 100644 --- a/KeeAnywhere/StorageProviders/OneDrive/OneDriveApiExtensions.cs +++ b/KeeAnywhere/StorageProviders/OneDrive/OneDriveApiExtensions.cs @@ -1,4 +1,5 @@ using Microsoft.Graph; +using Microsoft.Graph.Drives.Item.Items.Item; using System; using System.Linq; using System.Threading.Tasks; @@ -18,7 +19,7 @@ public static class OneDriveApiExtensions /// by the OneDrive storage provider. /// /// - public static IDriveItemRequestBuilder DriveItemFromStorageProviderItemId(this IGraphServiceClient api, string itemId) + public static DriveItemItemRequestBuilder DriveItemFromStorageProviderItemId(this GraphServiceClient api, string itemId) { // ID must include a drive id prefix. // See also OneDriveStorageProvider.MakeStorageProviderItemId. @@ -43,7 +44,7 @@ public static IDriveItemRequestBuilder DriveItemFromStorageProviderItemId(this I /// An extra Web request has to be made to determine if the top /// folder is remote or local. That's why this method is async. /// - public async static Task DriveItemFromPathAsync(this IGraphServiceClient api, string path) + public async static Task DriveItemFromPathAsync(this GraphServiceClient api, string path) { // The top folder could be a shared folder, in which case it's // on a different drive than the default. The path will use the @@ -51,10 +52,14 @@ public async static Task DriveItemFromPathAsync(this I // from its actual (remote) name. if (string.IsNullOrEmpty(path)) throw new ArgumentOutOfRangeException("path"); var parts = path.Split('/'); + var rootItem = await api.Me.Drive.GetAsync(); + if (parts.Length == 1) - return api.Drive.Root.ItemWithPath(parts[0]); + { + return api.Drives[rootItem.Id].Root.ItemWithPath(parts[0]); + } - var topFolder = await api.Drive.Root.ItemWithPath(Uri.EscapeDataString(parts[0])).Request().GetAsync(); + var topFolder = await api.Drives[rootItem.Id].Root.ItemWithPath(Uri.EscapeDataString(parts[0])).GetAsync(); var driveId = topFolder.RemoteItem == null ? topFolder.ParentReference.DriveId : topFolder.RemoteItem.ParentReference.DriveId; var topFolderId = topFolder.RemoteItem == null ? topFolder.Id : topFolder.RemoteItem.Id; // The top folder's apparent name can be different from its diff --git a/KeeAnywhere/StorageProviders/OneDrive/OneDriveAuthenticationProvider.cs b/KeeAnywhere/StorageProviders/OneDrive/OneDriveAuthenticationProvider.cs index 12c5e93..54f0bf9 100644 --- a/KeeAnywhere/StorageProviders/OneDrive/OneDriveAuthenticationProvider.cs +++ b/KeeAnywhere/StorageProviders/OneDrive/OneDriveAuthenticationProvider.cs @@ -1,10 +1,14 @@ using System; +using System.Collections.Generic; using System.Net.Http; using System.Net.Http.Headers; +using System.Threading; using System.Threading.Tasks; using IdentityModel.OidcClient.Results; using KeeAnywhere.OAuth2; using Microsoft.Graph; +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Abstractions.Authentication; namespace KeeAnywhere.StorageProviders.OneDrive { @@ -20,7 +24,7 @@ public OneDriveAuthenticationProvider(OidcFlow flow, string refreshToken) _refreshToken = refreshToken; } - public async Task AuthenticateRequestAsync(HttpRequestMessage request) + public async Task AuthenticateRequestAsync(RequestInformation request, Dictionary additionalAuthenticationContext = null, CancellationToken cancellationToken = default(CancellationToken)) { var token = _token; @@ -31,12 +35,7 @@ public async Task AuthenticateRequestAsync(HttpRequestMessage request) if (token.IsError) { _token = null; - throw new ServiceException( - new Error - { - //Code = GraphErrorCode.AuthenticationFailure, - Message = _token.Error - }); + throw new ServiceException(_token.Error); } _token = token; @@ -45,7 +44,7 @@ public async Task AuthenticateRequestAsync(HttpRequestMessage request) var accessToken = token.AccessToken; if (!string.IsNullOrEmpty(accessToken)) { - request.Headers.Authorization = new AuthenticationHeaderValue(CoreConstants.Headers.Bearer, accessToken); + request.Headers.Add("Authorization", new AuthenticationHeaderValue(CoreConstants.Headers.Bearer, accessToken).ToString()); } } } diff --git a/KeeAnywhere/StorageProviders/OneDrive/OneDriveHelper.cs b/KeeAnywhere/StorageProviders/OneDrive/OneDriveHelper.cs index e6aa84c..33f0a47 100644 --- a/KeeAnywhere/StorageProviders/OneDrive/OneDriveHelper.cs +++ b/KeeAnywhere/StorageProviders/OneDrive/OneDriveHelper.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using System.Windows.Forms; using IdentityModel; using KeeAnywhere.Configuration; using KeeAnywhere.OAuth2; @@ -35,7 +37,7 @@ never the real production keys. "Files.ReadWrite" }; - private static readonly IDictionary Cache = new Dictionary(); + private static readonly IDictionary Cache = new Dictionary(); public static OidcFlow CreateOidcFlow() { @@ -45,18 +47,25 @@ public static OidcFlow CreateOidcFlow() }; } - public static IGraphServiceClient GetApi(AccountConfiguration account) + public static GraphServiceClient GetApi(AccountConfiguration account) { if (Cache.ContainsKey(account.Id)) return Cache[account.Id]; var authProvider = new OneDriveAuthenticationProvider(CreateOidcFlow(), account.Secret); - var httpProvider = new HttpProvider(ProxyTools.CreateHttpClientHandler(), true) - { - OverallTimeout = Timeout.InfiniteTimeSpan - }; + //var httpProvider = new HttpProvider(ProxyTools.CreateHttpClientHandler(), true) + //{ + // OverallTimeout = Timeout.InfiniteTimeSpan + //}; + + //var api = new GraphServiceClient(authProvider, httpProvider); + //var api = new GraphServiceClient(ProxyTools.CreateHttpClient(), authProvider); + //var api = new GraphServiceClient(authProvider); + + var handlers = GraphClientFactory.CreateDefaultHandlers(); + var httpClient = GraphClientFactory.Create(handlers, "v1.0", "Global", ProxyTools.GetProxy()); + var api = new GraphServiceClient(httpClient, authProvider); - var api = new GraphServiceClient(authProvider, httpProvider); Cache.Add(account.Id, api); return api; diff --git a/KeeAnywhere/StorageProviders/OneDrive/OneDriveStorageProvider.cs b/KeeAnywhere/StorageProviders/OneDrive/OneDriveStorageProvider.cs index 6e260d8..2f1d2af 100644 --- a/KeeAnywhere/StorageProviders/OneDrive/OneDriveStorageProvider.cs +++ b/KeeAnywhere/StorageProviders/OneDrive/OneDriveStorageProvider.cs @@ -5,13 +5,15 @@ using System.Threading.Tasks; using KeeAnywhere.Configuration; using Microsoft.Graph; +using Microsoft.Graph.Drives.Item.Items.Item.Copy; +using Microsoft.Graph.Models; namespace KeeAnywhere.StorageProviders.OneDrive { public class OneDriveStorageProvider : IStorageProvider { private readonly AccountConfiguration _account; - private readonly IGraphServiceClient _api; + private readonly GraphServiceClient _api; public OneDriveStorageProvider(AccountConfiguration account) { @@ -24,7 +26,6 @@ public async Task Load(string path) { var stream = await (await _api.DriveItemFromPathAsync(path)) .Content - .Request() .GetAsync(); return stream; @@ -35,8 +36,7 @@ public async Task Save(Stream stream, string path) { var uploadedItem = await (await _api.DriveItemFromPathAsync(path)) .Content - .Request() - .PutAsync(stream); + .PutAsync(stream); if (uploadedItem == null) throw new InvalidOperationException("Save to OneDrive failed."); @@ -46,24 +46,29 @@ public async Task Save(Stream stream, string path) public async Task Copy(string sourcePath, string destPath) { var destFilename = CloudPath.GetFileName(destPath); - var destItem = await (await _api.DriveItemFromPathAsync(destPath)).Request().GetAsync(); + var destItem = await (await _api.DriveItemFromPathAsync(destPath)).GetAsync(); if (destItem == null) throw new FileNotFoundException("OneDrive: Folder not found.", destPath); + var body = new CopyPostRequestBody + { + Name = destFilename, + ParentReference = new ItemReference { Id = destItem.Id } + }; + await (await _api.DriveItemFromPathAsync(sourcePath)) - .Copy(destFilename, new ItemReference {Id = destItem.Id}) - .Request(/*new[] {new HeaderOption("Prefer", "respond-async"), }*/) - .PostAsync(); + .Copy.PostAsync(body); } public async Task Delete(string path) { - await (await _api.DriveItemFromPathAsync(path)).Request().DeleteAsync(); + await (await _api.DriveItemFromPathAsync(path)).DeleteAsync(); } public async Task GetRootItem() { - var odItem = await _api.Drive.Root.Request().GetAsync(); + var rootItem = await _api.Me.Drive.GetAsync(); + var odItem = await _api.Drives[rootItem.Id].Root.GetAsync(); if (odItem == null) return null; @@ -83,19 +88,19 @@ public async Task> GetChildrenByParentItem(Stor { if (parent == null) throw new ArgumentNullException("parent"); - var odChildren = await _api.DriveItemFromStorageProviderItemId(parent.Id).Children.Request().GetAsync(); + var odChildren = await _api.DriveItemFromStorageProviderItemId(parent.Id).Children.GetAsync(); var children = - odChildren.Select(odItem => CreateStorageProviderItemFromOneDriveItem(odItem)).ToArray(); + odChildren.Value.Select(odItem => CreateStorageProviderItemFromOneDriveItem(odItem)).ToArray(); return children; } public async Task> GetChildrenByParentPath(string path) { - var odChildren = await (await _api.DriveItemFromPathAsync(path)).Children.Request().GetAsync(); + var odChildren = await (await _api.DriveItemFromPathAsync(path)).Children.GetAsync(); var children = - odChildren.Select(odItem => CreateStorageProviderItemFromOneDriveItem(odItem)).ToArray(); + odChildren.Value.Select(odItem => CreateStorageProviderItemFromOneDriveItem(odItem)).ToArray(); return children; } diff --git a/KeeAnywhere/app.config b/KeeAnywhere/app.config index 116a6a9..eb8afea 100644 --- a/KeeAnywhere/app.config +++ b/KeeAnywhere/app.config @@ -200,7 +200,7 @@ - + @@ -216,19 +216,19 @@ - + - + - + - + @@ -248,15 +248,15 @@ - + - + - + @@ -268,19 +268,19 @@ - + - + - + - + @@ -288,7 +288,7 @@ - + @@ -298,9 +298,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/KeeAnywhere/packages.config b/KeeAnywhere/packages.config index 488b4e2..822053c 100644 --- a/KeeAnywhere/packages.config +++ b/KeeAnywhere/packages.config @@ -1,65 +1,99 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/chocolatey/keepass-plugin-keeanywhere.nuspec b/chocolatey/keepass-plugin-keeanywhere.nuspec index d9a7e7f..7314e27 100644 --- a/chocolatey/keepass-plugin-keeanywhere.nuspec +++ b/chocolatey/keepass-plugin-keeanywhere.nuspec @@ -54,7 +54,7 @@ Supported providers: - + From a77a57e4abe3b960cdcf2b52cefb32300cdb53ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=B6lts?= Date: Fri, 21 Jun 2024 09:42:31 +0200 Subject: [PATCH 2/2] Updated dependencies --- KeeAnywhere/KeeAnywhere.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/KeeAnywhere/KeeAnywhere.csproj b/KeeAnywhere/KeeAnywhere.csproj index b2e6f55..49afa23 100644 --- a/KeeAnywhere/KeeAnywhere.csproj +++ b/KeeAnywhere/KeeAnywhere.csproj @@ -285,7 +285,7 @@ ..\packages\System.Memory.Data.8.0.0\lib\net462\System.Memory.Data.dll - + ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll True True @@ -588,9 +588,9 @@ - 2.47 + 2.57 - 4.6.1 + 4.8.0