Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<IncludeOperationsSharedSource>true</IncludeOperationsSharedSource>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" />
<!-- <PackageReference Include="Azure.Core" /> -->
<ProjectReference Include="..\..\..\..\sdk\core\Azure.Core\src\Azure.Core.csproj" />
Comment on lines +7 to +8
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

The PackageReference to Azure.Core is commented out and replaced with a ProjectReference. This appears to be a temporary change for testing purposes. Ensure this is intentional and should be included in the PR, or if it should be reverted before merging.

Suggested change
<!-- <PackageReference Include="Azure.Core" /> -->
<ProjectReference Include="..\..\..\..\sdk\core\Azure.Core\src\Azure.Core.csproj" />
<PackageReference Include="Azure.Core" />
<!-- <ProjectReference Include="..\..\..\..\sdk\core\Azure.Core\src\Azure.Core.csproj" /> -->

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<ProjectReference Include="..\..\..\..\sdk\core\Azure.Core\src\Azure.Core.csproj" />
<ProjectReference Include="..\..\Azure.Core\src\Azure.Core.csproj" />

I think we can simplify a bit. Probably want to throw an issue in for the "change back to a package ref" as well.

<PackageReference Include="Azure.Identity" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NUnit" />
Expand Down
9 changes: 8 additions & 1 deletion sdk/core/Azure.Core.TestFramework/src/MockTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class MockTransport : HttpPipelineTransport

public bool? ExpectSyncPipeline { get; set; }

public List<HttpPipelineTransportOptions> TransportUpdates { get; } = [];
Copy link
Member

Choose a reason for hiding this comment

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

why is this public?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is on the mock transport so that code that is testing this can observe the transport updates that have occurred.


public MockTransport()
{
RequestGate = new AsyncGate<MockRequest, MockResponse>();
Expand All @@ -38,7 +40,7 @@ public MockTransport(params MockResponse[] responses)
};
}

public MockTransport(Func<MockRequest, MockResponse> responseFactory): this(req => responseFactory((MockRequest)req.Request))
public MockTransport(Func<MockRequest, MockResponse> responseFactory) : this(req => responseFactory((MockRequest)req.Request))
{
}

Expand Down Expand Up @@ -72,6 +74,11 @@ public override async ValueTask ProcessAsync(HttpMessage message)
await ProcessCore(message);
}

public override void Update(HttpPipelineTransportOptions options)
{
TransportUpdates.Add(options);
}

private async Task ProcessCore(HttpMessage message)
{
if (!(message.Request is MockRequest request))
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/api/Azure.Core.net462.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ public partial struct AccessToken
public AccessToken(string accessToken, System.DateTimeOffset expiresOn) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn, string tokenType) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn, string tokenType, System.Security.Cryptography.X509Certificates.X509Certificate2 bindingCertificate) { throw null; }
public System.Security.Cryptography.X509Certificates.X509Certificate2? BindingCertificate { get { throw null; } set { } }
public System.DateTimeOffset ExpiresOn { get { throw null; } }
public System.DateTimeOffset? RefreshOn { get { throw null; } }
public string Token { get { throw null; } }
Expand Down Expand Up @@ -1042,12 +1044,15 @@ public partial class HttpClientTransport : Azure.Core.Pipeline.HttpPipelineTrans
{
public static readonly Azure.Core.Pipeline.HttpClientTransport Shared;
public HttpClientTransport() { }
public HttpClientTransport(System.Func<Azure.Core.Pipeline.HttpPipelineTransportOptions, System.Net.Http.HttpClient> clientFactory) { }
public HttpClientTransport(System.Func<Azure.Core.Pipeline.HttpPipelineTransportOptions, System.Net.Http.HttpMessageHandler> handlerFactory) { }
public HttpClientTransport(System.Net.Http.HttpClient client) { }
public HttpClientTransport(System.Net.Http.HttpMessageHandler messageHandler) { }
public sealed override Azure.Core.Request CreateRequest() { throw null; }
public void Dispose() { }
public override void Process(Azure.Core.HttpMessage message) { }
public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message) { throw null; }
public override void UpdateTransport(Azure.Core.Pipeline.HttpPipelineTransportOptions options) { }
Copy link
Member

Choose a reason for hiding this comment

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

since the method is on transport type, should it be called simply Update?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I think that makes sense.

}
public partial class HttpPipeline
{
Expand Down Expand Up @@ -1103,6 +1108,7 @@ protected HttpPipelineTransport() { }
public abstract Azure.Core.Request CreateRequest();
public abstract void Process(Azure.Core.HttpMessage message);
public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message);
public virtual void UpdateTransport(Azure.Core.Pipeline.HttpPipelineTransportOptions options) { }
}
public partial class HttpPipelineTransportOptions
{
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/api/Azure.Core.net472.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ public partial struct AccessToken
public AccessToken(string accessToken, System.DateTimeOffset expiresOn) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn, string tokenType) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn, string tokenType, System.Security.Cryptography.X509Certificates.X509Certificate2 bindingCertificate) { throw null; }
public System.Security.Cryptography.X509Certificates.X509Certificate2? BindingCertificate { get { throw null; } set { } }
public System.DateTimeOffset ExpiresOn { get { throw null; } }
public System.DateTimeOffset? RefreshOn { get { throw null; } }
public string Token { get { throw null; } }
Expand Down Expand Up @@ -1042,12 +1044,15 @@ public partial class HttpClientTransport : Azure.Core.Pipeline.HttpPipelineTrans
{
public static readonly Azure.Core.Pipeline.HttpClientTransport Shared;
public HttpClientTransport() { }
public HttpClientTransport(System.Func<Azure.Core.Pipeline.HttpPipelineTransportOptions, System.Net.Http.HttpClient> clientFactory) { }
public HttpClientTransport(System.Func<Azure.Core.Pipeline.HttpPipelineTransportOptions, System.Net.Http.HttpMessageHandler> handlerFactory) { }
public HttpClientTransport(System.Net.Http.HttpClient client) { }
public HttpClientTransport(System.Net.Http.HttpMessageHandler messageHandler) { }
public sealed override Azure.Core.Request CreateRequest() { throw null; }
public void Dispose() { }
public override void Process(Azure.Core.HttpMessage message) { }
public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message) { throw null; }
public override void UpdateTransport(Azure.Core.Pipeline.HttpPipelineTransportOptions options) { }
}
public partial class HttpPipeline
{
Expand Down Expand Up @@ -1103,6 +1108,7 @@ protected HttpPipelineTransport() { }
public abstract Azure.Core.Request CreateRequest();
public abstract void Process(Azure.Core.HttpMessage message);
public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message);
public virtual void UpdateTransport(Azure.Core.Pipeline.HttpPipelineTransportOptions options) { }
}
public partial class HttpPipelineTransportOptions
{
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/api/Azure.Core.net8.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ public partial struct AccessToken
public AccessToken(string accessToken, System.DateTimeOffset expiresOn) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn, string tokenType) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn, string tokenType, System.Security.Cryptography.X509Certificates.X509Certificate2 bindingCertificate) { throw null; }
public System.Security.Cryptography.X509Certificates.X509Certificate2? BindingCertificate { get { throw null; } set { } }
public System.DateTimeOffset ExpiresOn { get { throw null; } }
public System.DateTimeOffset? RefreshOn { get { throw null; } }
public string Token { get { throw null; } }
Expand Down Expand Up @@ -1055,12 +1057,15 @@ public partial class HttpClientTransport : Azure.Core.Pipeline.HttpPipelineTrans
{
public static readonly Azure.Core.Pipeline.HttpClientTransport Shared;
public HttpClientTransport() { }
public HttpClientTransport(System.Func<Azure.Core.Pipeline.HttpPipelineTransportOptions, System.Net.Http.HttpClient> clientFactory) { }
public HttpClientTransport(System.Func<Azure.Core.Pipeline.HttpPipelineTransportOptions, System.Net.Http.HttpMessageHandler> handlerFactory) { }
public HttpClientTransport(System.Net.Http.HttpClient client) { }
public HttpClientTransport(System.Net.Http.HttpMessageHandler messageHandler) { }
public sealed override Azure.Core.Request CreateRequest() { throw null; }
public void Dispose() { }
public override void Process(Azure.Core.HttpMessage message) { }
public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message) { throw null; }
public override void UpdateTransport(Azure.Core.Pipeline.HttpPipelineTransportOptions options) { }
}
public partial class HttpPipeline
{
Expand Down Expand Up @@ -1117,6 +1122,7 @@ protected HttpPipelineTransport() { }
public abstract Azure.Core.Request CreateRequest();
public abstract void Process(Azure.Core.HttpMessage message);
public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message);
public virtual void UpdateTransport(Azure.Core.Pipeline.HttpPipelineTransportOptions options) { }
}
public partial class HttpPipelineTransportOptions
{
Expand Down
6 changes: 6 additions & 0 deletions sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ public partial struct AccessToken
public AccessToken(string accessToken, System.DateTimeOffset expiresOn) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn, string tokenType) { throw null; }
public AccessToken(string accessToken, System.DateTimeOffset expiresOn, System.DateTimeOffset? refreshOn, string tokenType, System.Security.Cryptography.X509Certificates.X509Certificate2 bindingCertificate) { throw null; }
public System.Security.Cryptography.X509Certificates.X509Certificate2? BindingCertificate { get { throw null; } set { } }
public System.DateTimeOffset ExpiresOn { get { throw null; } }
public System.DateTimeOffset? RefreshOn { get { throw null; } }
public string Token { get { throw null; } }
Expand Down Expand Up @@ -1042,12 +1044,15 @@ public partial class HttpClientTransport : Azure.Core.Pipeline.HttpPipelineTrans
{
public static readonly Azure.Core.Pipeline.HttpClientTransport Shared;
public HttpClientTransport() { }
public HttpClientTransport(System.Func<Azure.Core.Pipeline.HttpPipelineTransportOptions, System.Net.Http.HttpClient> clientFactory) { }
public HttpClientTransport(System.Func<Azure.Core.Pipeline.HttpPipelineTransportOptions, System.Net.Http.HttpMessageHandler> handlerFactory) { }
public HttpClientTransport(System.Net.Http.HttpClient client) { }
public HttpClientTransport(System.Net.Http.HttpMessageHandler messageHandler) { }
public sealed override Azure.Core.Request CreateRequest() { throw null; }
public void Dispose() { }
public override void Process(Azure.Core.HttpMessage message) { }
public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message) { throw null; }
public override void UpdateTransport(Azure.Core.Pipeline.HttpPipelineTransportOptions options) { }
}
public partial class HttpPipeline
{
Expand Down Expand Up @@ -1103,6 +1108,7 @@ protected HttpPipelineTransport() { }
public abstract Azure.Core.Request CreateRequest();
public abstract void Process(Azure.Core.HttpMessage message);
public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message);
public virtual void UpdateTransport(Azure.Core.Pipeline.HttpPipelineTransportOptions options) { }
}
public partial class HttpPipelineTransportOptions
{
Expand Down
24 changes: 24 additions & 0 deletions sdk/core/Azure.Core/src/AccessToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.ClientModel.Primitives;
using System.Security.Cryptography.X509Certificates;

namespace Azure.Core
{
Expand Down Expand Up @@ -52,6 +53,23 @@ public AccessToken(string accessToken, DateTimeOffset expiresOn, DateTimeOffset?
TokenType = tokenType;
}

/// <summary>
/// Creates a new instance of <see cref="AccessToken"/> using the provided <paramref name="accessToken"/> and <paramref name="expiresOn"/>.
/// </summary>
/// <param name="accessToken">The access token value.</param>
/// <param name="expiresOn">The access token expiry date.</param>
/// <param name="refreshOn">Specifies the time when the cached token should be proactively refreshed.</param>
/// <param name="tokenType">The access token type.</param>
/// <param name="bindingCertificate">The binding certificate for the access token.</param>
public AccessToken(string accessToken, DateTimeOffset expiresOn, DateTimeOffset? refreshOn, string tokenType, X509Certificate2 bindingCertificate)
{
Token = accessToken;
ExpiresOn = expiresOn;
RefreshOn = refreshOn;
TokenType = tokenType;
BindingCertificate = bindingCertificate;
}

/// <summary>
/// Get the access token value.
/// </summary>
Expand All @@ -72,6 +90,12 @@ public AccessToken(string accessToken, DateTimeOffset expiresOn, DateTimeOffset?
/// </summary>
public string TokenType { get; }

/// <summary>
/// Gets or sets the binding certificate for the access token.
/// This is used when authenticating via Proof of Possession (PoP).
Copy link
Member

Choose a reason for hiding this comment

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

May be a good idea to throw a <seealso> in here that points to the PoP docs.

/// </summary>
public X509Certificate2? BindingCertificate { get; set; }

/// <inheritdoc />
public override bool Equals(object? obj)
{
Expand Down
Loading
Loading