Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Artifactory NuGet V3 API #585

Merged
merged 9 commits into from
Oct 21, 2023

Conversation

JoC0de
Copy link
Collaborator

@JoC0de JoC0de commented Oct 15, 2023

fixes #579

  • fix preference screen switching to different nuget source type
  • allow using authenticated V3 api
  • allow overwriting nuget source api version
  • allow using encrypted nuget source passwords
  • fix some warnings

To fix the issue that Artifactory doesn't have a PackageBaseAddress I used a dialog:
image
If clicked on "Configure for Artifactory" the configuration is updated to the following:
image

So I added PackageDownloadUrlTemplateOverwrite witch should allow even customization for other non standard NuGet V3 API's

@JoC0de JoC0de self-assigned this Oct 15, 2023
src/NuGetForUnity.Cli/Fakes/EditorUtility.cs Show resolved Hide resolved
src/NuGetForUnity.Cli/Fakes/Mathf.cs Show resolved Hide resolved
src/NuGetForUnity/Editor/PackageSource/NugetApiClientV3.cs Outdated Show resolved Hide resolved
var decryptedByteArray = Encoding.UTF8.GetBytes(value);

#if UNITY_EDITOR_WIN
var encryptedByteArray = ProtectedData.Protect(decryptedByteArray, EntropyBytes, DataProtectionScope.CurrentUser);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried loading this version in Unity 2021.3.12f1 .netstandard2.1 and I got errors like:
src\NuGetForUnity\Editor\Configuration\ConfigurationEncryptionHelper.cs(36,38): error CS0103: The name 'ProtectedData' does not exist in the current context

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it working for 2023.1.11f somehow Unity ships the Editor with the System.Security.Cryptography.ProtectedData.dll, placed inside C:\Program Files\Unity\Hub\Editor\2023.1.1f1\Editor\Data\NetStandard\EditorExtensions\System.Security.Cryptography.ProtectedData.dll. With this it even works wen targeting .netstandard2.1.
I couldn't find any information about when Unity added this file to the Editor. For now I changed the pragma to include UNITY_2023_1_OR_NEWER. I will try to find some time to test it on 2022.

packageDownloadUrlTemplate = $"{registrationsBaseUrl}Download/{{0}}/{{1}}";
PackageDownloadUrlTemplateOverwrite = packageDownloadUrlTemplate;
packageSource.UpdateSearchBatchSize =
1; // Artifactory somehow can't handle search queries containing multiple packageId's.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping you will find some magic incantation to make it work :). I'll see if I can open an issue to Artifactory about this tomorrow.

@JoC0de JoC0de force-pushed the feature/support-artifactory-v3-api branch from ce1e95e to c787f89 Compare October 16, 2023 22:27
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should add some UI to allow modifying this data but that can be a separate PR.

* fix preference screen switching to different nuget source type
* allow using authenticated V3 api
* allow overwriting nuget source api version
* allow using encrypted nuget source passwords
* fix some warnings
@JoC0de JoC0de force-pushed the feature/support-artifactory-v3-api branch from 221b6de to 6d74db4 Compare October 20, 2023 22:17
@JoC0de JoC0de force-pushed the feature/support-artifactory-v3-api branch from 2881e38 to a7982f9 Compare October 21, 2023 11:07
@JoC0de JoC0de merged commit 1a27127 into GlitchEnzo:master Oct 21, 2023
8 checks passed
@JoC0de JoC0de deleted the feature/support-artifactory-v3-api branch October 21, 2023 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Artifactory issues vi APIv3
3 participants