Skip to content

Commit 92834c8

Browse files
author
Safia Abdalla
authored
Reduce console spew when creating secrets in user-jwts (#42542)
1 parent 92fa655 commit 92834c8

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/Tools/dotnet-user-jwts/src/Helpers/DevJwtCliHelpers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ namespace Microsoft.AspNetCore.Authentication.JwtBearer.Tools;
1414

1515
internal static class DevJwtCliHelpers
1616
{
17-
public static string GetOrSetUserSecretsId(IReporter reporter, string projectFilePath)
17+
public static string GetOrSetUserSecretsId(string projectFilePath)
1818
{
19-
var resolver = new ProjectIdResolver(reporter, projectFilePath);
19+
var resolver = new ProjectIdResolver(NullReporter.Singleton, projectFilePath);
2020
var id = resolver.Resolve(projectFilePath, configuration: null);
2121
if (string.IsNullOrEmpty(id))
2222
{
23-
return UserSecretsCreator.CreateUserSecretsId(reporter, projectFilePath, projectFilePath);
23+
return UserSecretsCreator.CreateUserSecretsId(NullReporter.Singleton, projectFilePath, projectFilePath);
2424
}
2525
return id;
2626
}
@@ -52,7 +52,7 @@ public static bool GetProjectAndSecretsId(string projectPath, IReporter reporter
5252
return false;
5353
}
5454

55-
userSecretsId = GetOrSetUserSecretsId(reporter, project);
55+
userSecretsId = GetOrSetUserSecretsId(project);
5656
if (userSecretsId == null)
5757
{
5858
reporter.Error($"Project does not contain a user secrets ID.");

src/Tools/dotnet-user-jwts/test/UserJwtsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void List_HandlesNoSecretsInProject()
4949
var app = new Program(_console);
5050

5151
app.Run(new[] { "list", "--project", project });
52-
Assert.Contains("Set UserSecretsId to ", _console.GetOutput());
52+
Assert.DoesNotContain("Set UserSecretsId to ", _console.GetOutput());
5353
Assert.Contains("No JWTs created yet!", _console.GetOutput());
5454
}
5555

@@ -62,7 +62,7 @@ public void Create_CreatesSecretOnNoSecretInproject()
6262
app.Run(new[] { "create", "--project", project });
6363
var output = _console.GetOutput();
6464
Assert.DoesNotContain("could not find SecretManager.targets", output);
65-
Assert.Contains("Set UserSecretsId to ", output);
65+
Assert.DoesNotContain("Set UserSecretsId to ", output);
6666
Assert.Contains("New JWT saved", output);
6767
}
6868

0 commit comments

Comments
 (0)