11using System . Globalization ;
2+ using Microsoft . Extensions . Logging ;
3+ using Microsoft . Extensions . Logging . Abstractions ;
24using Microsoft . IdentityModel . Tokens ;
35using OpenIddict . Abstractions ;
46using OpenIddict . Demo . Server . ExtensionGrants ;
@@ -14,6 +16,8 @@ public class ServerDataSeedContributor : IDataSeedContributor, ITransientDepende
1416 private readonly IOpenIddictApplicationManager _applicationManager ;
1517 private readonly IOpenIddictScopeManager _scopeManager ;
1618
19+ public ILogger < ServerDataSeedContributor > Logger { get ; set ; }
20+
1721 public ServerDataSeedContributor (
1822 ICurrentTenant currentTenant ,
1923 IOpenIddictApplicationManager applicationManager ,
@@ -22,6 +26,7 @@ public ServerDataSeedContributor(
2226 _currentTenant = currentTenant ;
2327 _applicationManager = applicationManager ;
2428 _scopeManager = scopeManager ;
29+ Logger = NullLogger < ServerDataSeedContributor > . Instance ;
2530 }
2631
2732 public async Task SeedAsync ( DataSeedContext context )
@@ -169,10 +174,11 @@ await _applicationManager.CreateAsync(new OpenIddictApplicationDescriptor
169174 var jwksPath = Path . Combine ( AppContext . BaseDirectory , "jwks.json" ) ;
170175 if ( ! File . Exists ( jwksPath ) )
171176 {
172- Console . WriteLine (
173- $ "[OpenIddict] WARNING: JWKS file not found at '{ jwksPath } '. " +
177+ Logger . LogWarning (
178+ " JWKS file not found at '{JwksPath }'. " +
174179 "Skipping creation of the 'AbpConsoleAppWithJwks' client. " +
175- "Run 'abp generate-jwks' in the app/ directory to generate the key pair." ) ;
180+ "Run 'abp generate-jwks' in the app/ directory to generate the key pair." ,
181+ jwksPath ) ;
176182 }
177183 else
178184 {
0 commit comments