@@ -25,7 +25,7 @@ public static class SigninCredentialExtension
2525
2626 private const string FileName = nameof ( FileName ) ;
2727 private const string FilePassword = nameof ( FilePassword ) ;
28- private const string KeyStoreIssuer = nameof ( KeyStoreIssuer ) ;
28+ private const string CertificateThumbprint = nameof ( CertificateThumbprint ) ;
2929
3030 public static IIdentityServerBuilder AddSigninCredentialFromConfig (
3131 this IIdentityServerBuilder builder , IConfigurationSection options , ILogger logger , IHostingEnvironment env )
@@ -74,14 +74,18 @@ private static void AddCertificateFromEnvironment(IIdentityServerBuilder builder
7474 private static void AddCertificateFromStore ( IIdentityServerBuilder builder ,
7575 IConfigurationSection options , ILogger logger )
7676 {
77- var keyIssuer = options . GetValue < string > ( KeyStoreIssuer ) ;
77+ var keyIssuer = options . GetValue < string > ( CertificateThumbprint ) ;
7878 logger . LogInformation ( $ "SigninCredentialExtension adding key from store by { keyIssuer } ") ;
7979
80- X509Store store = new X509Store ( StoreName . My , StoreLocation . LocalMachine ) ;
80+ X509Store store = new X509Store ( StoreName . My , StoreLocation . CurrentUser ) ;
8181 store . Open ( OpenFlags . ReadOnly ) ;
8282
83- var certificates = store . Certificates . Find ( X509FindType . FindByIssuerName , keyIssuer , true ) ;
84-
83+ var certificates = store . Certificates . Find ( X509FindType . FindByThumbprint , keyIssuer , false ) ;
84+ logger . LogInformation ( $ "Certificates on store: { store . Certificates . Count } ") ;
85+ foreach ( var storeCertificate in store . Certificates )
86+ {
87+ logger . LogInformation ( $ "{ storeCertificate . Thumbprint } - { storeCertificate . IssuerName . Name } ") ;
88+ }
8589 if ( certificates . Count > 0 )
8690 builder . AddSigningCredential ( certificates [ 0 ] ) ;
8791 else
0 commit comments