Skip to content

Add StoreWithSubjectName credential source#245

Merged
iNinja merged 6 commits intomainfrom
iinglese/add-store-with-subjectname-as-credential-source
Mar 2, 2026
Merged

Add StoreWithSubjectName credential source#245
iNinja merged 6 commits intomainfrom
iinglese/add-store-with-subjectname-as-credential-source

Conversation

@iNinja
Copy link
Copy Markdown
Contributor

@iNinja iNinja commented Feb 27, 2026

Add StoreWithSubjectName credential source

Summary

Adds a new CredentialSource enum value, StoreWithSubjectName = 13, that allows a certificate to be
located in the Windows certificate store by matching a substring of its Subject field, rather than
requiring an exact distinguished name.

Motivation

The existing StoreWithDistinguishedName source requires the full X.500 distinguished name
(e.g. CN=MyCert, OU=..., O=..., C=...). In practice, callers often only know a short friendly name
fragment. StoreWithSubjectName fills this gap by accepting a partial, case-insensitive substring.

Changes

Area Detail
CredentialSource.cs New StoreWithSubjectName = 13 enum member with full XML doc and selection-semantics remarks
CredentialDescription.cs New CertificateSubjectName property (backing field, _cachedId invalidation, copy constructor, Id switch case, CredentialType switch arm)
CredentialDescriptionJsonConverter.cs Read and Write cases for StoreWithSubjectName / CertificateSubjectName
PublicAPI.Unshipped.txt (×6) CertificateSubjectName get/set and CredentialSource.StoreWithSubjectName = 13 declared for all TFMs
CredentialDescriptionTest.cs CertificateFromStoreBySubjectName test with subjectname_json / subjectname_csharp doc-snippet markers
CredentialDescriptionJsonConverterTest.cs SerializeDeserialize_CertificateFromStoreBySubjectName round-trip test
CredentialDescriptionIdTest.cs StoreWithSubjectName entry in the ID display dictionary; CachedId_InvalidatedWhen_CertificateSubjectName_Changes test
README.md Mermaid class diagram updated with new property and enum value
docs/credentialdescription.md Table row, JSON example, C# example, and certificate-store-paths note updated

Test results

All tests pass across all targeted frameworks:

Framework Passed
net8.0 95
net10.0 95
net462 84

JSON converter tests are excluded on net462 (#if NET8_0_OR_GREATER), which accounts for the
difference in count.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new credential source option that allows describing Windows certificate-store credentials by (partial) certificate Subject name, extending the existing store-based lookup options in Microsoft.Identity.Abstractions.

Changes:

  • Introduces CredentialSource.StoreWithSubjectName = 13 and a new CredentialDescription.CertificateSubjectName property.
  • Extends CredentialDescriptionJsonConverter and ID/type derivation logic to support the new source.
  • Updates tests and documentation (README + docs/credentialdescription.md) with examples and diagrams.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/Microsoft.Identity.Abstractions.Tests/CredentialDescriptionTest.cs Adds doc-snippet-backed test/example for store lookup by subject name
test/Microsoft.Identity.Abstractions.Tests/CredentialDescriptionJsonConverterTest.cs Adds JSON round-trip test for StoreWithSubjectName
test/Microsoft.Identity.Abstractions.Tests/CredentialDescriptionIdTest.cs Extends ID display coverage and cache invalidation test for the new property
src/Microsoft.Identity.Abstractions/PublicAPI/*/PublicAPI.Unshipped.txt Declares new public API surface across TFMs
src/Microsoft.Identity.Abstractions/ApplicationOptions/CredentialSource.cs Adds the new enum value and XML doc examples
src/Microsoft.Identity.Abstractions/ApplicationOptions/CredentialDescriptionJsonConverter.cs Adds read/write support for CertificateSubjectName / StoreWithSubjectName
src/Microsoft.Identity.Abstractions/ApplicationOptions/CredentialDescription.cs Adds property, copy support, ID generation, and credential type mapping
docs/credentialdescription.md Adds documentation/examples for subject-name-based store lookup
README.md Updates Mermaid diagram to include the new property/enum value
Comments suppressed due to low confidence (1)

src/Microsoft.Identity.Abstractions/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt:8

  • PublicAPI.Unshipped.txt for netstandard2.1 ends with multiple blank lines. Please trim to match the formatting used in the other TFMs (typically a single trailing newline).

Comment thread docs/credentialdescription.md Outdated
Comment thread README.md
iNinja and others added 2 commits February 27, 2026 17:58
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ignacio Inglese <inglese.ignacio@gmail.com>
@iNinja iNinja merged commit b73b647 into main Mar 2, 2026
5 checks passed
@iNinja iNinja deleted the iinglese/add-store-with-subjectname-as-credential-source branch March 2, 2026 10:21
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