Skip to content
This repository was archived by the owner on Jun 15, 2026. It is now read-only.

Commit 852de41

Browse files
authored
Merge pull request #45 from Azure-Samples/jennyf/msal4.6
update msal and fix su_si authority name
2 parents 365e548 + e840c31 commit 852de41

8 files changed

Lines changed: 14 additions & 30 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
55
</startup>
6-
</configuration>
6+
</configuration>

active-directory-b2c-wpf/App.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public partial class App : Application
2020
public static string[] ApiScopes = { "https://fabrikamb2c.onmicrosoft.com/helloapi/demo.read" };
2121
public static string ApiEndpoint = "https://fabrikamb2chello.azurewebsites.net/hello";
2222
private static string AuthorityBase = $"https://{AzureAdB2CHostname}/tfp/{Tenant}/";
23-
public static string AuthoritySignInSignUp = $"{AuthorityBase}{PolicySignUpSignIn}";
23+
public static string AuthoritySignUpSignIn = $"{AuthorityBase}{PolicySignUpSignIn}";
2424
public static string AuthorityEditProfile = $"{AuthorityBase}{PolicyEditProfile}";
2525
public static string AuthorityResetPassword = $"{AuthorityBase}{PolicyResetPassword}";
2626

@@ -29,7 +29,7 @@ public partial class App : Application
2929
static App()
3030
{
3131
PublicClientApp = PublicClientApplicationBuilder.Create(ClientId)
32-
.WithB2CAuthority(AuthoritySignInSignUp)
32+
.WithB2CAuthority(AuthoritySignUpSignIn)
3333
.WithLogging(Log, LogLevel.Verbose, false) //PiiEnabled set to false
3434
.Build();
3535

active-directory-b2c-wpf/MainWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private async void Window_Loaded(object sender, RoutedEventArgs e)
201201
DisplayUserInfo(authResult);
202202
UpdateSignInState(true);
203203
}
204-
catch (MsalUiRequiredException ex)
204+
catch (MsalUiRequiredException)
205205
{
206206
// Ignore, user will need to sign in interactively.
207207
ResultText.Text = "You need to sign-in first, and then Call API";

active-directory-b2c-wpf/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

active-directory-b2c-wpf/Properties/Settings.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

active-directory-b2c-wpf/TokenCacheHelper.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,13 @@
2727

2828
using System.IO;
2929
using System.Security.Cryptography;
30+
using System.Windows.Controls;
3031
using Microsoft.Identity.Client;
3132

3233
namespace active_directory_b2c_wpf
3334
{
3435
static class TokenCacheHelper
3536
{
36-
37-
/// <summary>
38-
/// Get the user token cache
39-
/// </summary>
40-
/// <returns></returns>
41-
public static TokenCache GetUserCache()
42-
{
43-
if (usertokenCache == null)
44-
{
45-
usertokenCache = new TokenCache();
46-
usertokenCache.SetBeforeAccess(BeforeAccessNotification);
47-
usertokenCache.SetAfterAccess(AfterAccessNotification);
48-
}
49-
return usertokenCache;
50-
}
51-
52-
static TokenCache usertokenCache;
53-
5437
/// <summary>
5538
/// Path to the token cache
5639
/// </summary>

active-directory-b2c-wpf/active-directory-b2c-wpf.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
<OutputType>WinExe</OutputType>
99
<RootNamespace>active_directory_b2c_wpf</RootNamespace>
1010
<AssemblyName>active_directory_b2c_wpf</AssemblyName>
11-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1414
<WarningLevel>4</WarningLevel>
1515
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
16+
<TargetFrameworkProfile />
1617
</PropertyGroup>
1718
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1819
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -34,8 +35,8 @@
3435
<WarningLevel>4</WarningLevel>
3536
</PropertyGroup>
3637
<ItemGroup>
37-
<Reference Include="Microsoft.Identity.Client, Version=4.5.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae, processorArchitecture=MSIL">
38-
<HintPath>..\packages\Microsoft.Identity.Client.4.5.0\lib\net45\Microsoft.Identity.Client.dll</HintPath>
38+
<Reference Include="Microsoft.Identity.Client, Version=4.6.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae, processorArchitecture=MSIL">
39+
<HintPath>..\packages\Microsoft.Identity.Client.4.6.0\lib\net45\Microsoft.Identity.Client.dll</HintPath>
3940
</Reference>
4041
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
4142
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>

active-directory-b2c-wpf/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.Identity.Client" version="4.5.0" targetFramework="net452" />
3+
<package id="Microsoft.Identity.Client" version="4.6.0" targetFramework="net452" />
44
<package id="Microsoft.NETCore.Platforms" version="1.1.1" targetFramework="net452" />
55
<package id="Microsoft.NETCore.Targets" version="1.1.3" targetFramework="net452" />
66
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" />

0 commit comments

Comments
 (0)