Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .azure/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ variables:
- name: WindowsArm64InstallersLogArgs
value: /bl:artifacts/log/Release/Build.Installers.Arm64.binlog
- name: _InternalRuntimeDownloadArgs
value: -RuntimeSourceFeed https://dotnetbuilds.blob.core.windows.net/internal
value: -RuntimeSourceFeed https://ci.dot.net/internal
-RuntimeSourceFeedKey $(dotnetbuilds-internal-container-read-token-base64)
/p:DotNetAssetRootAccessTokenSuffix='$(dotnetbuilds-internal-container-read-token-base64)'
# The code signing doesn't use the aspnet build scripts, so the msbuild parameters have to be passed directly. This
# is awkward but necessary because the eng/common/ build scripts don't add the msbuild properties automatically.
- name: _InternalRuntimeDownloadCodeSignArgs
value: $(_InternalRuntimeDownloadArgs)
/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal
/p:DotNetRuntimeSourceFeed=https://ci.dot.net/internal
/p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
- group: DotNet-HelixApi-Access
- ${{ if notin(variables['Build.Reason'], 'PullRequest') }}:
Expand Down
4 changes: 4 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-runtime -->
<add key="darc-int-dotnet-runtime-831d23e" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-runtime-831d23e5/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-runtime -->
<!-- Begin: Package sources from dotnet-efcore -->
<add key="darc-int-dotnet-efcore-68c7e19" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-efcore-68c7e194/nuget/v3/index.json" />
<!-- End: Package sources from dotnet-efcore -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
Expand All @@ -28,8 +30,10 @@
<clear />
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
<!-- Begin: Package sources from dotnet-efcore -->
<add key="darc-int-dotnet-efcore-68c7e19" value="true" />
<!-- End: Package sources from dotnet-efcore -->
<!-- Begin: Package sources from dotnet-runtime -->
<add key="darc-int-dotnet-runtime-831d23e" value="true" />
<!-- End: Package sources from dotnet-runtime -->
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
</disabledPackageSources>
Expand Down
320 changes: 160 additions & 160 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

160 changes: 80 additions & 80 deletions eng/Versions.props

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions eng/helix/helix.proj
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
<PackageType>runtime</PackageType>
</AdditionalDotNetPackage>

<AdditionalDotNetPackageFeed Include="https://dotnetbuilds.blob.core.windows.net/internal"
<AdditionalDotNetPackageFeed Include="https://ci.dot.net/internal"
Condition="'$(SYSTEM_TEAMPROJECT)' == 'internal'">
<SasToken>$([System.Environment]::GetEnvironmentVariable('DotNetBuildsInternalReadSasToken'))</SasToken>
</AdditionalDotNetPackageFeed>

<AdditionalDotNetPackageFeed Include="https://dotnetbuilds.blob.core.windows.net/internal"
<AdditionalDotNetPackageFeed Include="https://ci.dot.net/internal"
Condition="'$(SYSTEM_TEAMPROJECT)' == 'internal'">
<SasToken>$([System.Environment]::GetEnvironmentVariable('DotNetBuildsInternalReadSasToken'))</SasToken>
</AdditionalDotNetPackageFeed>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,15 +560,15 @@
<!-- Try various places to find the runtime. It's either released (use official version),
public but un-released (use dotnetbuilds/public), or internal and unreleased (use dotnetbuilds/internal) -->
<ItemGroup>
<UrisToDownload Include="https://dotnetcli.azureedge.net/dotnet/$(DotNetRuntimeDownloadPath)" />
<UrisToDownload Include="https://dotnetbuilds.azureedge.net/public/$(DotNetRuntimeDownloadPath)" />
<UrisToDownload Include="https://dotnetbuilds.azureedge.net/internal/$(DotNetRuntimeDownloadPath)"
<UrisToDownload Include="https://builds.dotnet.microsoft.com/dotnet/$(DotNetRuntimeDownloadPath)" />
<UrisToDownload Include="https://ci.dot.net/public/$(DotNetRuntimeDownloadPath)" />
<UrisToDownload Include="https://ci.dot.net/internal/$(DotNetRuntimeDownloadPath)"
Condition=" '$(DotnetRuntimeSourceFeedKey)' != '' ">
<token>$(DotnetRuntimeSourceFeedKey)</token>
</UrisToDownload>
</ItemGroup>

<DownloadFile Condition=" !Exists('$(DotNetRuntimeArchive)') "

Check failure on line 571 in src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj#L571

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj(571,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) HttpRequestException: The SSL connection could not be established, see inner exception. at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.InjectNewHttp11ConnectionAsync(QueueItem queueItem) at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.DotNet.Arcade.Sdk.DownloadFile.DownloadWithRetriesAsync(HttpClient httpClient, String uri) in /_/src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs:line 154 AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: RevocationStatusUnknown at System.Net.Security.SslStream.SendAuthResetSignal(ReadOnlySpan`1 alert, ExceptionDispatchInfo exception) at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions) at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken) at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)

Check failure on line 571 in src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj#L571

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj(571,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) HttpRequestException: The SSL connection could not be established, see inner exception. at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.InjectNewHttp11ConnectionAsync(QueueItem queueItem) at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.DotNet.Arcade.Sdk.DownloadFile.DownloadWithRetriesAsync(HttpClient httpClient, String uri) in /_/src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs:line 154 AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: RevocationStatusUnknown at System.Net.Security.SslStream.SendAuthResetSignal(ReadOnlySpan`1 alert, ExceptionDispatchInfo exception) at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions) at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken) at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)

Check failure on line 571 in src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj#L571

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj(571,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) HttpRequestException: The SSL connection could not be established, see inner exception. at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.InjectNewHttp11ConnectionAsync(QueueItem queueItem) at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.DotNet.Arcade.Sdk.DownloadFile.DownloadWithRetriesAsync(HttpClient httpClient, String uri) in /_/src/Microsoft.DotNet.Arcade.Sdk/src/DownloadFile.cs:line 154 AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: RevocationStatusUnknown at System.Net.Security.SslStream.SendAuthResetSignal(ReadOnlySpan`1 alert, ExceptionDispatchInfo exception) at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions) at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken) at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)

Check failure on line 571 in src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj#L571

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj(571,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) Download from all targets failed. List of attempted targets: https://builds.dotnet.microsoft.com/dotnet/Runtime/9.0.3-servicing.25111.13/dotnet-runtime-9.0.3-osx-x64.tar.gz, https://ci.dot.net/public/Runtime/9.0.3-servicing.25111.13/dotnet-runtime-9.0.3-osx-x64.tar.gz

Check failure on line 571 in src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj#L571

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.csproj(571,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) Failed to download file using addresses in Uri and/or Uris.
Uris="@(UrisToDownload)"
DestinationPath="$(DotNetRuntimeArchive)" />

Expand Down
15 changes: 14 additions & 1 deletion src/Identity/Core/src/SignInManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,21 @@ public virtual async Task<bool> CanSignInAsync(TUser user)
public virtual async Task RefreshSignInAsync(TUser user)
{
var auth = await Context.AuthenticateAsync(AuthenticationScheme);
IList<Claim> claims = Array.Empty<Claim>();
if (!auth.Succeeded || auth.Principal?.Identity?.IsAuthenticated != true)
{
Logger.LogError("RefreshSignInAsync prevented because the user is not currently authenticated. Use SignInAsync instead for initial sign in.");
return;
}

var authenticatedUserId = UserManager.GetUserId(auth.Principal);
var newUserId = await UserManager.GetUserIdAsync(user);
if (authenticatedUserId == null || authenticatedUserId != newUserId)
{
Logger.LogError("RefreshSignInAsync prevented because currently authenticated user has a different UserId. Use SignInAsync instead to change users.");
return;
}

IList<Claim> claims = Array.Empty<Claim>();
var authenticationMethod = auth?.Principal?.FindFirst(ClaimTypes.AuthenticationMethod);
var amr = auth?.Principal?.FindFirst("amr");

Expand Down
80 changes: 66 additions & 14 deletions src/Identity/test/Identity.Test/SignInManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -592,38 +592,38 @@ public async Task CanExternalSignIn(bool isPersistent, bool supportsLockout)
[InlineData(true, false)]
[InlineData(false, true)]
[InlineData(false, false)]
public async Task CanResignIn(
// Suppress warning that says theory methods should use all of their parameters.
// See comments below about why this isn't used.
#pragma warning disable xUnit1026
bool isPersistent,
#pragma warning restore xUnit1026
bool externalLogin)
public async Task CanResignIn(bool isPersistent, bool externalLogin)
{
// Setup
var user = new PocoUser { UserName = "Foo" };
var context = new DefaultHttpContext();
var auth = MockAuth(context);
var loginProvider = "loginprovider";
var id = new ClaimsIdentity();
var id = new ClaimsIdentity("authscheme");
if (externalLogin)
{
id.AddClaim(new Claim(ClaimTypes.AuthenticationMethod, loginProvider));
}
// REVIEW: auth changes we lost the ability to mock is persistent
//var properties = new AuthenticationProperties { IsPersistent = isPersistent };
var authResult = AuthenticateResult.NoResult();

var claimsPrincipal = new ClaimsPrincipal(id);
var properties = new AuthenticationProperties { IsPersistent = isPersistent };
var authResult = AuthenticateResult.Success(new AuthenticationTicket(claimsPrincipal, properties, "authscheme"));
auth.Setup(a => a.AuthenticateAsync(context, IdentityConstants.ApplicationScheme))
.Returns(Task.FromResult(authResult)).Verifiable();
var manager = SetupUserManager(user);
manager.Setup(m => m.GetUserId(claimsPrincipal)).Returns(user.Id.ToString());
var signInManager = new Mock<SignInManager<PocoUser>>(manager.Object,
new HttpContextAccessor { HttpContext = context },
new Mock<IUserClaimsPrincipalFactory<PocoUser>>().Object,
null, null, new Mock<IAuthenticationSchemeProvider>().Object, null)
{ CallBase = true };
//signInManager.Setup(s => s.SignInAsync(user, It.Is<AuthenticationProperties>(p => p.IsPersistent == isPersistent),
//externalLogin? loginProvider : null)).Returns(Task.FromResult(0)).Verifiable();
signInManager.Setup(s => s.SignInWithClaimsAsync(user, It.IsAny<AuthenticationProperties>(), It.IsAny<IEnumerable<Claim>>())).Returns(Task.FromResult(0)).Verifiable();

signInManager.Setup(s => s.SignInWithClaimsAsync(user,
It.Is<AuthenticationProperties>(properties => properties.IsPersistent == isPersistent),
It.Is<IEnumerable<Claim>>(claims => !externalLogin ||
claims.Any(claim => claim.Type == ClaimTypes.AuthenticationMethod && claim.Value == loginProvider))))
.Returns(Task.FromResult(0)).Verifiable();

signInManager.Object.Context = context;

// Act
Expand All @@ -634,6 +634,58 @@ public async Task CanResignIn(
signInManager.Verify();
}

[Fact]
public async Task ResignInNoOpsAndLogsErrorIfNotAuthenticated()
{
var user = new PocoUser { UserName = "Foo" };
var context = new DefaultHttpContext();
var auth = MockAuth(context);
var manager = SetupUserManager(user);
var logger = new TestLogger<SignInManager<PocoUser>>();
var signInManager = new Mock<SignInManager<PocoUser>>(manager.Object,
new HttpContextAccessor { HttpContext = context },
new Mock<IUserClaimsPrincipalFactory<PocoUser>>().Object,
null, logger, new Mock<IAuthenticationSchemeProvider>().Object, null)
{ CallBase = true };
auth.Setup(a => a.AuthenticateAsync(context, IdentityConstants.ApplicationScheme))
.Returns(Task.FromResult(AuthenticateResult.NoResult())).Verifiable();

await signInManager.Object.RefreshSignInAsync(user);

Assert.Contains("RefreshSignInAsync prevented because the user is not currently authenticated. Use SignInAsync instead for initial sign in.", logger.LogMessages);
auth.Verify();
signInManager.Verify(s => s.SignInWithClaimsAsync(It.IsAny<PocoUser>(), It.IsAny<AuthenticationProperties>(), It.IsAny<IEnumerable<Claim>>()),
Times.Never());
}

[Fact]
public async Task ResignInNoOpsAndLogsErrorIfAuthenticatedWithDifferentUser()
{
var user = new PocoUser { UserName = "Foo" };
var context = new DefaultHttpContext();
var auth = MockAuth(context);
var manager = SetupUserManager(user);
var logger = new TestLogger<SignInManager<PocoUser>>();
var signInManager = new Mock<SignInManager<PocoUser>>(manager.Object,
new HttpContextAccessor { HttpContext = context },
new Mock<IUserClaimsPrincipalFactory<PocoUser>>().Object,
null, logger, new Mock<IAuthenticationSchemeProvider>().Object, null)
{ CallBase = true };
var id = new ClaimsIdentity("authscheme");
var claimsPrincipal = new ClaimsPrincipal(id);
var authResult = AuthenticateResult.Success(new AuthenticationTicket(claimsPrincipal, new AuthenticationProperties(), "authscheme"));
auth.Setup(a => a.AuthenticateAsync(context, IdentityConstants.ApplicationScheme))
.Returns(Task.FromResult(authResult)).Verifiable();
manager.Setup(m => m.GetUserId(claimsPrincipal)).Returns("different");

await signInManager.Object.RefreshSignInAsync(user);

Assert.Contains("RefreshSignInAsync prevented because currently authenticated user has a different UserId. Use SignInAsync instead to change users.", logger.LogMessages);
auth.Verify();
signInManager.Verify(s => s.SignInWithClaimsAsync(It.IsAny<PocoUser>(), It.IsAny<AuthenticationProperties>(), It.IsAny<IEnumerable<Claim>>()),
Times.Never());
}

[Theory]
[InlineData(true, true, true, true)]
[InlineData(true, true, false, true)]
Expand Down
6 changes: 3 additions & 3 deletions src/Installers/Windows/WindowsHostingBundle/Product.targets
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
-->
<ItemGroup>
<UrisToDownload Remove="@(UrisToDownload)" />
<UrisToDownload Include="https://dotnetcli.azureedge.net/dotnet/Runtime/%(RemoteAsset.Identity)" />
<UrisToDownload Include="https://dotnetbuilds.azureedge.net/public/Runtime/%(RemoteAsset.Identity)" />
<UrisToDownload Include="https://dotnetbuilds.azureedge.net/internal/Runtime/%(RemoteAsset.Identity)"
<UrisToDownload Include="https://builds.dotnet.microsoft.com/dotnet/Runtime/%(RemoteAsset.Identity)" />
<UrisToDownload Include="https://ci.dot.net/public/Runtime/%(RemoteAsset.Identity)" />
<UrisToDownload Include="https://ci.dot.net/internal/Runtime/%(RemoteAsset.Identity)"
Condition=" '$(DotnetRuntimeSourceFeedKey)' != '' ">
<token>$(DotnetRuntimeSourceFeedKey)</token>
</UrisToDownload>
Expand Down
Loading