Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade lasso and use incognito mode. #187

Merged
merged 18 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/AzureAuth.Test/AzureAuth.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
goagain marked this conversation as resolved.
Show resolved Hide resolved
<DefineConstants>PlatformWindows</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>

<!-- Stylecop warnings as errors flag for build to fail -->
Expand Down
2 changes: 1 addition & 1 deletion src/AzureAuth/AzureAuth.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Office.Lasso" Version="2022.1.6.1" />
<PackageReference Include="Microsoft.Office.Lasso" Version="2023.1.27.1" />
<PackageReference Include="Tomlyn" Version="0.11.0" />
</ItemGroup>

Expand Down
42 changes: 42 additions & 0 deletions src/AzureAuth/CommandInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.Authentication.AzureAuth
{
using System.IO.Abstractions;
using System.Reflection;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Logging;
using Microsoft.Office.Lasso.Telemetry;

/// <summary>
/// The command <see cref="CommandInfo"/> shows debug information and system runtime.
/// </summary>
[Command(Name = "info", Description = "Show debug information of AzureAuth. Please provide when asking for help.")]
goagain marked this conversation as resolved.
Show resolved Hide resolved
internal class CommandInfo
{
/// <summary>
/// This method executes the info process.
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="fileSystem">The file system.</param>
/// <returns>The error code: 0 is normal execution, and the rest means errors during execution.</returns>
public int OnExecute(ILogger<CommandInfo> logger, IFileSystem fileSystem)
{
Assembly assembly = Assembly.GetExecutingAssembly();
goagain marked this conversation as resolved.
Show resolved Hide resolved

string azureauthVersion = assembly.GetName().Version.ToString();
logger.LogInformation($"AzureAuth Version: {azureauthVersion}");

string deviceID = TelemetryMachineIDHelper.GetRandomDeviceIDAsync(fileSystem).Result;
logger.LogInformation($"Device ID: {deviceID}");
goagain marked this conversation as resolved.
Show resolved Hide resolved

logger.LogInformation($"Device Identifier File Location: {TelemetryMachineIDHelper.GetIdentifierLocation(fileSystem)}");
goagain marked this conversation as resolved.
Show resolved Hide resolved
logger.LogInformation($"To reset your device identifier, delete the file at {TelemetryMachineIDHelper.GetIdentifierLocation(fileSystem)}.");
goagain marked this conversation as resolved.
Show resolved Hide resolved

logger.LogInformation($"\nTo get the user's sid, use option --output=sid in normal authentication process.");
goagain marked this conversation as resolved.
Show resolved Hide resolved

return 0;
}
}
}
4 changes: 4 additions & 0 deletions src/AzureAuth/CommandMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace Microsoft.Authentication.AzureAuth
/// The command main class parses commands and dispatches to the corresponding methods.
/// </summary>
[Command(Name = "azureauth", Description = "A CLI interface to MSAL authentication")]
[Subcommand(typeof(CommandInfo))]
goagain marked this conversation as resolved.
Show resolved Hide resolved
public class CommandMain
{
private const string ResourceOption = "--resource";
Expand Down Expand Up @@ -489,6 +490,9 @@ private int GetToken()
case OutputMode.Json:
Console.Write(tokenResult.ToJson());
break;
case OutputMode.SID:
Console.Write(tokenResult.SID);
break;
case OutputMode.None:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/AzureAuth/ExceptionListToStringConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public string Message
/// <summary>
/// Sets the error code.
/// </summary>
/// <param name="exception">exception from which error code is extracted</param>
/// <param name="exception">exception from which error code is extracted.</param>
goagain marked this conversation as resolved.
Show resolved Hide resolved
private void SetAADErrorCode(Exception exception)
{
var exceptionType = exception.GetType();
Expand Down
5 changes: 5 additions & 0 deletions src/AzureAuth/OutputMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,10 @@ public enum OutputMode
/// The none.
/// </summary>
None,

/// <summary>
/// The SID.
goagain marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
SID,
goagain marked this conversation as resolved.
Show resolved Hide resolved
}
}
4 changes: 3 additions & 1 deletion src/AzureAuth/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ private static void Main(string[] args)
backend: backend,
ingestionToken: ingestionToken,
useAsync: true,
envVarsToCollect: new[] { "SYSTEM_DEFINITIONID", "QBUILD_DISTRIBUTED" });
envVarsToCollect: new[] { "SYSTEM_DEFINITIONID", "QBUILD_DISTRIBUTED" },
hideAlias: true,
hideMachineName: true);

// We want redirect stdout to get just token output
// while warnings and errors still go to stderr to be seen by a user.
Expand Down