Skip to content

Commit

Permalink
Merge pull request #65 from Azure-Samples/jenny/msal4.24
Browse files Browse the repository at this point in the history
update to msal 4.24
  • Loading branch information
trwalke authored Dec 5, 2020
2 parents 03490ae + 815389b commit b389ee1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
20 changes: 10 additions & 10 deletions active-directory-b2c-wpf/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public partial class App : Application
/// <summary>
/// Should be one of the choices on the Azure AD B2c / [This App] / Authentication blade
/// </summary>
private static readonly string RedirectUri = "https://fabrikamb2c.b2clogin.com/oauth2/nativeclient";
private static readonly string RedirectUri = $"https://{AzureAdB2CHostname}/oauth2/nativeclient";

/// <summary>
/// From Azure AD B2C / UserFlows blade
/// </summary>
public static string PolicySignUpSignIn = "b2c_1_susi";
public static string PolicyEditProfile = "b2c_1_edit_profile";
public static string PolicyResetPassword = "b2c_1_reset";
public const string PolicySignUpSignIn = "b2c_1_susi";
public const string PolicyEditProfile = "b2c_1_edit_profile";
public const string PolicyResetPassword = "b2c_1_reset";

/// <summary>
/// Note: AcquireTokenInteractive will fail to get the AccessToken if "Admin Consent" has not been granted to this scope. To achieve this:
Expand All @@ -45,18 +45,18 @@ public partial class App : Application
/// 2nd: Azure AD B2C / App registrations / [This App] / API Permissions / Add a permission / My APIs / [API App] / Select & Add Permissions
/// 3rd: Azure AD B2C / App registrations / [This App] / API Permissions / ... (next to add a permission) / Grant Admin Consent for [tenant]
/// </summary>
public static string[] ApiScopes = { "https://fabrikamb2c.onmicrosoft.com/helloapi/demo.read" };
public static readonly string[] ApiScopes = { "https://fabrikamb2c.onmicrosoft.com/helloapi/demo.read" };

/// <summary>
/// URL for API which will receive the bearer token corresponding to this authentication
/// </summary>
public static string ApiEndpoint = "https://fabrikamb2chello.azurewebsites.net/hello";
public static readonly string ApiEndpoint = "https://fabrikamb2chello.azurewebsites.net/hello";

// Shouldn't need to change these:
private static string AuthorityBase = $"https://{AzureAdB2CHostname}/tfp/{Tenant}/";
public static string AuthoritySignUpSignIn = $"{AuthorityBase}{PolicySignUpSignIn}";
public static string AuthorityEditProfile = $"{AuthorityBase}{PolicyEditProfile}";
public static string AuthorityResetPassword = $"{AuthorityBase}{PolicyResetPassword}";
private static readonly string AuthorityBase = $"https://{AzureAdB2CHostname}/tfp/{Tenant}/";
public static readonly string AuthoritySignUpSignIn = $"{AuthorityBase}{PolicySignUpSignIn}";
public static readonly string AuthorityEditProfile = $"{AuthorityBase}{PolicyEditProfile}";
public static readonly string AuthorityResetPassword = $"{AuthorityBase}{PolicyResetPassword}";

public static IPublicClientApplication PublicClientApp { get; private set; }

Expand Down
24 changes: 20 additions & 4 deletions active-directory-b2c-wpf/active-directory-b2c-wpf.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.SDK.Contracts.10.0.17763.1000\build\Microsoft.Windows.SDK.Contracts.props" Condition="Exists('..\packages\Microsoft.Windows.SDK.Contracts.10.0.17763.1000\build\Microsoft.Windows.SDK.Contracts.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -14,6 +15,8 @@
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -35,9 +38,11 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Identity.Client, Version=4.22.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Identity.Client.4.22.0\lib\net461\Microsoft.Identity.Client.dll</HintPath>
</Reference>
<PackageReference Include="Microsoft.Identity.Client">
<Version>4.23.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -97,7 +102,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand All @@ -107,4 +111,16 @@
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets" Condition="Exists('..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets'))" />
<Error Condition="!Exists('..\packages\System.Runtime.WindowsRuntime.UI.Xaml.4.6.0\build\net461\System.Runtime.WindowsRuntime.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Runtime.WindowsRuntime.UI.Xaml.4.6.0\build\net461\System.Runtime.WindowsRuntime.UI.Xaml.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.SDK.Contracts.10.0.17763.1000\build\Microsoft.Windows.SDK.Contracts.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.SDK.Contracts.10.0.17763.1000\build\Microsoft.Windows.SDK.Contracts.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.SDK.Contracts.10.0.17763.1000\build\Microsoft.Windows.SDK.Contracts.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.SDK.Contracts.10.0.17763.1000\build\Microsoft.Windows.SDK.Contracts.targets'))" />
</Target>
<Import Project="..\packages\System.Runtime.WindowsRuntime.UI.Xaml.4.6.0\build\net461\System.Runtime.WindowsRuntime.UI.Xaml.targets" Condition="Exists('..\packages\System.Runtime.WindowsRuntime.UI.Xaml.4.6.0\build\net461\System.Runtime.WindowsRuntime.UI.Xaml.targets')" />
<Import Project="..\packages\Microsoft.Windows.SDK.Contracts.10.0.17763.1000\build\Microsoft.Windows.SDK.Contracts.targets" Condition="Exists('..\packages\Microsoft.Windows.SDK.Contracts.10.0.17763.1000\build\Microsoft.Windows.SDK.Contracts.targets')" />
</Project>
5 changes: 4 additions & 1 deletion active-directory-b2c-wpf/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Identity.Client" version="4.22.0" targetFramework="net472" />
<package id="Microsoft.Identity.Client" version="4.24.0" targetFramework="net472" />
<package id="Microsoft.NETCore.Platforms" version="1.1.1" targetFramework="net452" />
<package id="Microsoft.NETCore.Targets" version="1.1.3" targetFramework="net452" />
<package id="Microsoft.Windows.SDK.Contracts" version="10.0.17763.1000" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" />
<package id="System.Private.Uri" version="4.3.2" targetFramework="net452" />
<package id="System.Runtime.WindowsRuntime" version="4.6.0" targetFramework="net472" />
<package id="System.Runtime.WindowsRuntime.UI.Xaml" version="4.6.0" targetFramework="net472" />
</packages>

0 comments on commit b389ee1

Please sign in to comment.