Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
Update to MSAL 4.36 and add deterministic builds. (#150)
Browse files Browse the repository at this point in the history
* Update to MSAL 4.36 and add deterministic builds.

* Minor fix to test app.
  • Loading branch information
pmaytak authored Aug 31, 2021
1 parent f8620fc commit db4e08f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@


</PropertyGroup>

<ItemGroup Label="For ContinuousIntegrationBuild support">
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
<!-- defines repository top level dir-->
</ItemGroup>

<ItemGroup Label="Dev Dependencies">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="16.9.60" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3" PrivateAssets="All" />
Expand Down
2 changes: 1 addition & 1 deletion sample/ManualTestApp/ManualTestApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.35.1" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.36.0" />
<!-- <PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="2.16.8" /> -->

<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.9" />
Expand Down
13 changes: 6 additions & 7 deletions sample/ManualTestApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ static async Task Main(string[] args)

while (true)
{

// Display menu
Console.WriteLine($@"
1. Acquire Token using Username and Password - for TEST only, do not use in production!
Expand All @@ -59,7 +58,7 @@ 7. Use persistence layer to read / write any data
c. Clear cache
e. Expire Access Tokens (TEST only!)
x. Exit app
Enter your Selection: ");
Enter your selection: ");
char.TryParse(Console.ReadLine(), out var selection);
try
{
Expand Down Expand Up @@ -163,7 +162,7 @@ await Task.WhenAll(
byte[] secretBytes = Encoding.UTF8.GetBytes("secret");
Console.WriteLine("Writing...");
storage.WriteData(secretBytes);

Console.WriteLine("Writing again...");
storage.WriteData(secretBytes);

Expand All @@ -175,7 +174,7 @@ await Task.WhenAll(
Console.WriteLine("Deleting...");
storage.Clear();


break;


Expand All @@ -189,7 +188,7 @@ await Task.WhenAll(
Config.KeyChainAccountName);

storage = Storage.Create(storageProperties.Build());

string lockFilePath = Path.Combine(Config.CacheDir, Config.CacheFileName + ".lockfile");

using (new CrossPlatLock(lockFilePath)) // cross-process only
Expand Down Expand Up @@ -239,7 +238,7 @@ await Task.WhenAll(
.Single(p => p.Name == "Microsoft.Identity.Client.ITokenCacheInternal.Accessor")
.GetValue(pca.UserTokenCache);

var internalAccessTokens = accessor.GetType().GetMethod("GetAllAccessTokens").Invoke(accessor, null) as IEnumerable<object>;
var internalAccessTokens = accessor.GetType().GetMethod("GetAllAccessTokens").Invoke(accessor, new object[] { null }) as IEnumerable<object>;

foreach (var internalAt in internalAccessTokens)
{
Expand All @@ -249,7 +248,7 @@ await Task.WhenAll(

var ctor = typeof(TokenCacheNotificationArgs).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance).Single();

var notificationArgs = ctor.Invoke(new object[] { pca.UserTokenCache, Config.ClientId, null, true, false, true, null });
var notificationArgs = ctor.Invoke(new object[] { pca.UserTokenCache, Config.ClientId, null, true, false, true, null, null, null });
var task = pca.UserTokenCache.GetType().GetRuntimeMethods()
.Single(m => m.Name == "Microsoft.Identity.Client.ITokenCacheInternal.OnAfterAccessAsync")
.Invoke(pca.UserTokenCache, new[] { notificationArgs });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Label="For CI build" Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.2.9" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Label="For CI build" Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<Import Project="..\Shared\Shared.projitems" Label="Shared" />

<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.35.1" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.36.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == '$(TargetFrameworkNetDesktop)'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client" Version="4.35.1" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.36.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.1" />
Expand Down

0 comments on commit db4e08f

Please sign in to comment.