Skip to content

Conversation

@Robbie-Microsoft
Copy link
Contributor

Implements #5591

@Robbie-Microsoft Robbie-Microsoft marked this pull request as ready for review December 8, 2025 18:22
@Robbie-Microsoft Robbie-Microsoft requested a review from a team as a code owner December 8, 2025 18:22

// CreateManagedIdentityAsync does a probe; Add one more CSR response for the actual acquire.
httpManager.AddMockHandler(MockHelpers.MockCsrResponse());
// Add mocks for successful non-attested flow (CSR + issuecredential + token)
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we need to update existing POP tests to use WithAttestationSupport()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. Tests already use .WithAttestationProviderForTests() which mocks what .WithAttestationSupport() does in production. No changes needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am concerned that if we ever remove the public API .WithAttestationSupport() our tests will never catch it


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.0.11217.181 d18.0
Copy link
Member

Choose a reason for hiding this comment

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

The solution file does not add the new project, only deletes the old one.

{
/// <summary>
/// Managed façade for <c>AttestationClientLib.dll</c>. Holds initialization state,
/// does ref-count hygiene on <see cref="SafeNCryptKeyHandle"/>, and returns a JWT.
/// </summary>
internal sealed class AttestationClient : IDisposable
Copy link
Member

Choose a reason for hiding this comment

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

This should not be part of the public API

/// High-level outcome categories returned by <see cref="AttestationClient.Attest"/>.
/// </summary>
internal enum AttestationStatus
public enum AttestationStatus
Copy link
Member

Choose a reason for hiding this comment

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

Should not be part of the public API

}

// Register the attestation token provider
return builder.WithAttestationProviderForTests(async (req, ct) =>
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 builder method suffixed with "ForTests" ? It is production code.


<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" />
<PackageReference Include="Microsoft.Identity.Client.MtlsPop" />
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to add the new project reference?

<Version>$(MicrosoftIdentityClientVersion)-preview</Version>
<!-- Copyright needs to be in the form of © not (c) to be compliant -->
<Title>MSAL.NET extension for managed identity proof-of-possession flows</Title>
<Title>MSAL.NET extension for KeyGuard attestation support</Title>
Copy link
Contributor

Choose a reason for hiding this comment

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

</ItemGroup>

<PropertyGroup>
<!-- Temporarily disable PublicAPI analyzer to generate correct signatures -->
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need these?

/// Key discovery / rotation is the caller's responsibility.
/// </summary>
internal static class PopKeyAttestor
public static class PopKeyAttestor
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be public?

<ItemGroup>
<ProjectReference Include="..\..\src\client\Microsoft.Identity.Client\Microsoft.Identity.Client.csproj" />
<ProjectReference Include="..\..\src\client\Microsoft.Identity.Client.MtlsPop\Microsoft.Identity.Client.MtlsPop.csproj" />
<ProjectReference Include="..\..\src\client\Microsoft.Identity.Client.KeyAttestation\Microsoft.Identity.Client.KeyAttestation.csproj" />
Copy link
Contributor

Choose a reason for hiding this comment

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

we may also need to fix the OneBranch release pipeline and update the project name


// CreateManagedIdentityAsync does a probe; Add one more CSR response for the actual acquire.
httpManager.AddMockHandler(MockHelpers.MockCsrResponse());
// Add mocks for successful non-attested flow (CSR + issuecredential + token)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am concerned that if we ever remove the public API .WithAttestationSupport() our tests will never catch it

/// The netstandard2.0 target relies on the IsExternalInit shim (see IsExternalInit.cs) to enable 'init'.
/// </remarks>
internal sealed record AttestationResult(
public sealed record AttestationResult(
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need to be public? think the safest way it to just rename the project and not recreate a new project. seems like there are many changes that are not necessary

Microsoft.Identity.Client.KeyAttestation.AttestationStatus.NotInitialized = 3 -> Microsoft.Identity.Client.KeyAttestation.AttestationStatus
Microsoft.Identity.Client.KeyAttestation.AttestationStatus.Success = 0 -> Microsoft.Identity.Client.KeyAttestation.AttestationStatus
Microsoft.Identity.Client.KeyAttestation.AttestationStatus.TokenEmpty = 2 -> Microsoft.Identity.Client.KeyAttestation.AttestationStatus
Microsoft.Identity.Client.KeyAttestation.ManagedIdentityAttestationExtensions
Copy link
Member

Choose a reason for hiding this comment

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

The old publicAPI file should match the new public API file.

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.

4 participants