Граф коммитов

371 Коммитов

Автор SHA1 Сообщение Дата
John Schmeichel ce5571bbed
Add publish parameter to build template (#438)
Add option to disable publishing artifacts
2023-07-19 08:46:10 -07:00
John Schmeichel b8b8facc72
Create 1.0.9 release (#435) 2023-07-12 15:16:26 -07:00
John Schmeichel cb98f0c844
MSAL cache env var should be interpreted as full file path (#434)
MSAL cache changes to align with GCM removed ability to customize the
full file path for the MSAL cache. Addresses #432
2023-07-12 10:51:19 -07:00
John Schmeichel ebafa53184
Onboard to central package management (#431)
Onboarding to Central Package Management:
https://learn.microsoft.com/en-us/nuget/consume-packages/Central-Package-Management
2023-06-28 13:25:35 -07:00
John Schmeichel bab9e30c4b
Add explicit version for Newtonsoft.Json (#430)
NuGet brings in very old versions of Newtonsoft.Json. Need to look at
upgrading NuGet dependencies, but in the meantime, bring back the
explicit version.
2023-06-28 09:44:48 -07:00
John Schmeichel 4381c166f2
Bump NuGet.Protocol package version to 5.11.5 (#429)
Bumping NuGet.Protocol version and removing explicit dependency where
not required as dependabot doesn't update all projects at once.
2023-06-28 09:07:09 -07:00
John Schmeichel f7af268965
Use System.Text.Json for json (de)serialization (#393)
The serialization and deserialization cost for Newtonsoft.Json causes
significant slowdowns, especially in the cases of cached tokens where
the process is not long lived. Swapping in System.Text.Json improves
startup times.

BenchmarkDotNet=v0.13.5, OS=Windows 11 (10.0.23430.1000)
Intel Xeon CPU E5-1650 v3 3.50GHz, 1 CPU, 12 logical and 6 physical
cores
 .NET SDK=8.0.100-preview.2.23157.25
   [Host]     : .NET 6.0.16 (6.0.1623.17311), X64 RyuJIT AVX2
   Job-KGDGIP : .NET 6.0.16 (6.0.1623.17311), X64 RyuJIT AVX2

System.Text.Json:

 IterationCount=1  RunStrategy=ColdStart  WarmupCount=0

 |             Method |       Mean | Error |  Allocated |
 |------------------- |-----------:|------:|-----------:|
 | CachedSessionToken |   460.5 ms |    NA |   519.3 KB |
 |    CachedMsalToken | 1,737.0 ms |    NA | 1979.85 KB |
 
  IterationCount=3  RunStrategy=ColdStart  WarmupCount=0

| Method | Mean | Error | StdDev | Median | Allocated |
|-------------------
|---------:|------------:|---------:|---------:|-----------:|
| CachedSessionToken | 254.9 ms | 2,957.7 ms | 162.1 ms | 163.6 ms |
481.46 KB |
| CachedMsalToken | 967.8 ms | 12,418.7 ms | 680.7 ms | 586.7 ms |
1889.65 KB |

Newtonsoft.Json:

 IterationCount=1  RunStrategy=ColdStart  WarmupCount=0

 |             Method |       Mean | Error | Allocated |
 |------------------- |-----------:|------:|----------:|
 | CachedSessionToken |   586.9 ms |    NA | 559.24 KB |
 |    CachedMsalToken | 2,074.3 ms |    NA |   2142 KB |
 
  IterationCount=3  RunStrategy=ColdStart  WarmupCount=0

| Method | Mean | Error | StdDev | Median | Allocated |
|-------------------
|-----------:|------------:|-----------:|---------:|-----------:|
| CachedSessionToken | 343.7 ms | 5,947.7 ms | 326.0 ms | 162.1 ms |
519.8 KB |
| CachedMsalToken | 1,277.7 ms | 20,494.6 ms | 1,123.4 ms | 660.3 ms |
2064.86 KB |
2023-06-27 16:50:48 -07:00
John Schmeichel 5177919a8c
Remove Azure Active Directory Authentication Library (ADAL) (#411)
This removes Azure Active Directory Authentication Library (ADAL)
support from the credential provider and all associated environment
variables.
2023-06-27 14:06:54 -07:00
John Schmeichel 2eaec110be
Update readme to link to .NET Core 3.1 removal (#428)
Ask from partner teams to include on the readme a link to the
deprecation announcement.
2023-06-27 12:56:22 -07:00
John Schmeichel 64ba044427
Include symbols for Microsoft.Artifacts.Authentication when publishing (#424) 2023-06-15 20:42:57 -07:00
John Schmeichel 184761b680
Upload VS manifest to correct organization (#423) 2023-06-15 13:20:54 -07:00
John Schmeichel 54e5949f33 Create 1.0.8 release 2023-06-06 08:59:25 -07:00
John Schmeichel c954695f25
Fix authentication assembly signing (#419)
Depending on the operation outputs are either pulled from the project
intermediate directory (e.g. in publish) or the output directory. Since
signing occurs after the build, the unsigned assembly has been copied to
the output directory so needs to be signed there as well.
2023-06-05 18:16:03 -07:00
John Schmeichel d722c918f1
Authentication library fixes (#418)
Updated to the latest version of MSAL and some other fixes for the
authentication library.
2023-06-05 14:32:44 -07:00
John Schmeichel 9ccd66d2ec
Create 1.0.7 release (#415) 2023-05-30 14:40:44 -07:00
John Schmeichel 705303f0a2
Use default credentials on http client handler (#414)
MSAL integrated Windows authentication requires using default
credentials. This is done if using MSALs http client factory, so must
explicitly opt into this behavior.

---------

Co-authored-by: John Erickson <jerick@microsoft.com>
2023-05-30 13:01:47 -07:00
John Schmeichel d332e325a2
Remove duplicate UserAgent header values (#412)
The MsalHttpClientFactory class already adds the UserAgent header values
when used, so can remove the ones added in Util/HttpClientFactory.
2023-05-10 08:20:09 -07:00
John Schmeichel 5600f76d68
Use Microsoft.Artifacts.Authentication in credential provider (#410)
Adding a reference to the Microsoft.Artifacts.Authentication project and
removing all associated code from the credential provider that it
replaces. Also includes a few bug fixes present in the credential
provider that were not yet ported to the library.
2023-05-08 17:13:11 -07:00
John Schmeichel 3645b39108 Create 1.0.6 release 2023-05-04 10:54:43 -07:00
John Schmeichel 41129f97f5 Revert "Revert "Enable MSAL by default"" 2023-05-03 19:49:33 -07:00
John Schmeichel 71322d7199 Fallback to old app if using ppe authority 2023-05-03 16:44:20 -07:00
John Schmeichel 9abad78d08
Add UserAgent and IMsalHttpClientFactory support to authentication library (#404)
Bringing PlatformUtils and UserAgent defaults over to the authentication
library. Since netstandard2.0 doesn't have all the types required it's
still expected that callers will need to construct their own http client
factory. For .NET Framework however, using a static HttpClient is still
the recommendation so providing some extension methods to support that.
2023-04-28 16:54:33 -07:00
John Schmeichel f5a44bd497
Create Microsoft.Artifacts.Authentication package (#388)
Proposed changes to pull the MSAL related types into their own project
and deliver as an extension to MSAL. Design and implementation are a
work in progress to collect feedback on the approach and API design.

Example usage of to create a PublicClientApplication with recommended
settings and defaults for Azure Artifacts and enumerate providers:

```csharp
var app = AzureArtifacts.CreateDefaultBuilder(authority)
    .WithBroker(true, logger)
    .WithLogging((LogLevel level, string message, bool containsPii) =>
    {
        // Application specific logging
    })
    .Build();

// Can use MsalTokenProviders which works for most cases, or compose the token providers manually
var providers = MsalTokenProviders.Get(app, logger);

var tokenRequest = new TokenRequest("https://pkgs.dev.azure.com/org")
{
    IsInteractive = true
};

foreach (var provider in providers)
{
    if (!provider.CanGetToken(tokenRequest))
        continue;

    var result = await provider.GetTokenAsync(tokenRequest);
}
```

1. Uses and extends the MSAL token types, and not trying to be a wrapper
around them. No plans to support more token authentication libraries in
the future.
2. Uses Microsoft.Extensions.Logging as the logging infrastructure, and
adaptors will be created where necessary to interface with client
tooling.
3. All settings and defaults are pulled out onto TokenRequest, or are
composable using extension methods.
2023-04-26 15:39:49 -07:00
John Schmeichel 501a6eafcc Create 1.0.5 release 2023-04-26 13:35:46 -07:00
John Schmeichel 90a2abdd5a
Add http client factory and user agent to identity provider requests (#400)
When using MSAL or ADAL authentication libraries no attempt is done to
populate the UserAgent header when making requests, and no great API is
provided to easily set this. The only mechanism is to implement their
IHttpClientFactory interface and customize the HttpClients being used by
the library. As such I'm taking this opportunity to use this factory to
return a singleton instance for use in all places that we're making HTTP
requests.

Additionally I'm updating the UserAgent header we're sending to include
more information about the platform and runtime, which now produces a
header that looks like the following: ```User-Agent:
CredentialProvider.Microsoft/1.0.4+aae4981de95d543b7935811c05474e393dd9e144
(Windows; X64; Microsoft Windows 10.0.19045) CLR/6.0.16
(.NETCoreApp,Version=v6.0; win10-x64; .NET 6.0.16)```
2023-04-26 11:26:28 -07:00
John Schmeichel 61a0215fbd
Add devcontainer.json and .vscode defaults (#398)
Add default devcontainer.json to enable the repository to build in
Codespaces. This builds from the dotnet latest images and adds .NET 6.0.
The repository is able to build, run, and test if using .NET 6.0
(probably .NET Core 3.1 as well but untested). .NET Framework requires
mono to run but didn't see any convenient features for that.

Also adding the artifacts-helper to set up NuGet authentication so
collaborators on the Azure DevOps feed are able to pull new packages
into the feed.
2023-04-26 00:59:39 -07:00
Zheng Hao Tang 742c428a19
Conda cred provider wrapper (#395)
A credential provider wrapper for Conda protocol. It will call the
credential provider and set the token into an environment variable for
Conda client. The conda package artifacts-credprovider-conda will be
published to anaconda.org for users to consume.
2023-04-25 14:29:13 -07:00
John Schmeichel a3e75291a0 Create 1.0.4 release 2023-04-24 13:29:26 -07:00
John Schmeichel 2437e85ee1
Cache http response headers (#397)
All of the methods off of IAuthUtil will probe the same url to get
response headers. We were making 3 requests for the same response, and
after #392 we made one less in the common case. Adding an internal cache
to simply cache the response headers by url. It's possible to refactor
to make this a little more explicit (e.g. pull the headers once and pass
that around) but those changes ended up being quite large and may cause
more work with planned changes.

Also passing the HttpCompletionOption.ResponseHeadersRead option since
we don't care about the request body or any trailing headers.
2023-04-24 09:54:54 -07:00
John Schmeichel c4c3a314e9
Default CanShowDialog to true for stand-alone mode (#376)
* Default CanShowDialog to true for stand-alone mode

* Check if interactive auth is supported
2023-04-19 15:04:08 -07:00
John Schmeichel 0ddbe1bc5a
Merge pull request #391 from microsoft/johsch/sign-outputs
Sign all assembly outputs
2023-04-19 14:36:40 -07:00
John Schmeichel 25c1c468c8
Merge pull request #392 from microsoft/johsch/known-host-fix
Fix valid host check for vanity urls
2023-04-19 14:35:53 -07:00
John Schmeichel 4a1680e4bc Fix valid host check for vanity urls 2023-04-19 08:44:37 -07:00
John Schmeichel 51ac8a9506 Sign all assembly outputs 2023-04-18 20:06:50 -07:00
John Schmeichel c2dc4f0796
Merge pull request #390 from microsoft/johsch/1.0.3-release
Create 1.0.3 release
2023-04-18 15:51:55 -07:00
John Schmeichel 639f8b8832
Merge pull request #389 from microsoft/johsch/msal-revert
Revert "Enable MSAL by default"
2023-04-18 14:12:35 -07:00
John Schmeichel 13dc9b809b Create 1.0.3 release 2023-04-18 14:03:25 -07:00
John Schmeichel 6aa0ac8375 Revert "Enable MSAL by default"
This reverts commit 644a50c501.
2023-04-18 12:28:59 -07:00
John Schmeichel 6d40d5b3ba
Merge pull request #384 from microsoft/johsch/msal-silent
Always run MsalSilentBearerTokenProvider to provide cached and refreshed tokens
2023-04-13 20:11:07 -07:00
John Schmeichel e48855fce6
Merge pull request #385 from microsoft/johsch/upgrade-msal
Upgrade MSAL dependencies to GA versions
2023-04-13 10:50:48 -07:00
John Schmeichel ed4dca6928 Always run MsalSilentBearerTokenProvider to provide cached and refreshed tokens 2023-04-12 21:57:21 -07:00
John Schmeichel f02dcc1882 Upgrade MSAL dependencies to GA versions 2023-04-12 21:51:50 -07:00
John Schmeichel e19f61d6c0
Merge pull request #382 from microsoft/johsch/stale-issues
Stop redirecting issues to developer community
2023-04-10 17:50:06 -07:00
John Schmeichel c73006a4aa Stop redirecting issues to developer community 2023-04-10 17:39:11 -07:00
John Schmeichel 144f57b315
Merge pull request #375 from microsoft/johsch/net6.0
Install scripts default to .NET 6.0 version
2023-03-30 13:25:47 -07:00
John Schmeichel 05d0d7ebcd Update docs 2023-03-30 11:25:51 -07:00
John Schmeichel 141c70750e
Merge pull request #374 from microsoft/johsch/msal
Enable MSAL by default and use new application for broker
2023-03-30 10:05:20 -07:00
John Schmeichel 86b2f7c5a7 Install scripts default to .NET 6.0 version 2023-03-29 17:26:35 -07:00
John Schmeichel dc5ac62765 Use new Azure Artifacts app for broker 2023-03-28 23:47:43 -07:00
John Schmeichel 644a50c501 Enable MSAL by default 2023-03-28 23:47:41 -07:00