Add StoreWithSubjectName credential source#245
Merged
Conversation
…ption and CredentialDescriptionJsonConverter to support it.
Contributor
There was a problem hiding this comment.
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 = 13and a newCredentialDescription.CertificateSubjectNameproperty. - Extends
CredentialDescriptionJsonConverterand 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.txtfor netstandard2.1 ends with multiple blank lines. Please trim to match the formatting used in the other TFMs (typically a single trailing newline).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Ignacio Inglese <inglese.ignacio@gmail.com>
bgavrilMS
approved these changes
Feb 27, 2026
cpp11nullptr
approved these changes
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
StoreWithSubjectNamecredential sourceSummary
Adds a new
CredentialSourceenum value,StoreWithSubjectName = 13, that allows a certificate to belocated in the Windows certificate store by matching a substring of its Subject field, rather than
requiring an exact distinguished name.
Motivation
The existing
StoreWithDistinguishedNamesource requires the full X.500 distinguished name(e.g.
CN=MyCert, OU=..., O=..., C=...). In practice, callers often only know a short friendly namefragment.
StoreWithSubjectNamefills this gap by accepting a partial, case-insensitive substring.Changes
CredentialSource.csStoreWithSubjectName = 13enum member with full XML doc and selection-semantics remarksCredentialDescription.csCertificateSubjectNameproperty (backing field,_cachedIdinvalidation, copy constructor,Idswitch case,CredentialTypeswitch arm)CredentialDescriptionJsonConverter.csReadandWritecases forStoreWithSubjectName/CertificateSubjectNamePublicAPI.Unshipped.txt(×6)CertificateSubjectNameget/set andCredentialSource.StoreWithSubjectName = 13declared for all TFMsCredentialDescriptionTest.csCertificateFromStoreBySubjectNametest withsubjectname_json/subjectname_csharpdoc-snippet markersCredentialDescriptionJsonConverterTest.csSerializeDeserialize_CertificateFromStoreBySubjectNameround-trip testCredentialDescriptionIdTest.csStoreWithSubjectNameentry in the ID display dictionary;CachedId_InvalidatedWhen_CertificateSubjectName_ChangestestREADME.mddocs/credentialdescription.mdTest results
All tests pass across all targeted frameworks:
net8.0net10.0net462