Skip to content

Commit 84cd4f5

Browse files
authored
Merge pull request #21 from AzureADQuickStarts/jmprieur/updateToLastestMsal
Updates to latest MSAL.NET
2 parents 9481a32 + 53b3f17 commit 84cd4f5

13 files changed

Lines changed: 388 additions & 345 deletions

TodoListClient/App.config

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
55
</startup>
66
<appSettings>
7-
<!-- ida:Client is a GUID representing the Application Id for the TodoListClient app that you copied from
8-
the App Registration Portal ((https://go.microsoft.com/fwlink/?linkid=2083908) -->
7+
<!-- Hostname for the Azure AD instance. {0} will be replaced by the value of ida:Tenant below
8+
You can change this URL if you want your application to sign-in users from other clouds
9+
than the Azure Global Cloud (See national clouds / sovereign clouds at https://aka.ms/aadv2-national-clouds)
10+
-->
11+
<add key="ida:AADInstance" value="https://login.microsoftonline.com/{0}/v2.0"/>
912

13+
<!--
14+
ida:Tenant can be:
15+
- a proper tenant Id (a GUID) or tenant domain (e.g. contoso.onmicrosoft.com) if your application signs-in only users of a given organization
16+
- or one of the following three words which are not proper tenants, but only conventions:
17+
- 'common' to sign-in Work or School accounts and Microsoft personal accounts
18+
- 'organizations' to sign-in Work or School accounts
19+
- 'consumers' to sign-in only Microsoft personal accounts
20+
This should be consistent with the audience of users who can sign-in, as specified during the application registration
21+
-->
22+
<add key="ida:Tenant" value="organizations"/>
23+
24+
<!--
25+
ClientID (ApplicationID) of your application as registered in the App Registration under Azure Active Directory
26+
in https://portal.azure.com
27+
-->
1028
<add key="ida:ClientId" value="{Enter the Application Id that you copied from the App Registration Portal.}" />
11-
12-
<!-- TodoListServiceScope is either:
13-
- the same as ida:ClientId, as V2 apps enable several platforms for a same application (a GUID)
14-
- or otherwise the scope of the Web API created with aht App Registration portal, for instance api://[V2-WebApi-AppId]/access_as_user
15-
where [V2-WebApi-AppId] is a GUID representing the Application ID of the Web API.
16-
- or otherwise this can be the scope of a V1 Web API (created with https://portal.azure.com) for instance [V1_WebApi-AppId]/user_impersonation
17-
where [V1-WebApi-AppId] is a GUID representing the Application ID (also named Client ID) of the V1 Web API created in https://portal.azure.com.
18-
In that case (V1 app), the Authority used to build the PubliClientApplication in MainWindow.xaml.cs should be set to
19-
"https://login.microsoftonline.com/organizations/" instead of "https://login.microsoftonline.com/common/"
29+
<!--
30+
todo:TodoListServiceScope is the scope of the Web API you want to call. This can be:
31+
- a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user)
32+
- a scope corresponding to a legacy application (for instance <GUID>/user_impersonation, where <GUID> is the
33+
clientId of a legacy application, created in the https://portal.azure.com portal.
2034
-->
2135

2236
<add key="TodoListServiceScope" value="api://{Enter the Application Id of your TodoListService from the app registration portal}/access_as_user" />

TodoListClient/App.xaml.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Configuration;
4-
using System.Data;
5-
using System.Linq;
6-
using System.Threading.Tasks;
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
74
using System.Windows;
85

96
namespace TodoListClient

TodoListClient/MainWindow.xaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818
</VisualBrush>
1919
</Grid.Resources>
2020
<StackPanel Grid.Row="0" Margin="5" VerticalAlignment="Top" Height="351">
21-
<Button HorizontalAlignment="Right" Content="Sign In" Margin="0" Click="SignIn" x:Name="SignInButton" Width="80" Height="30">
22-
<Button.Style>
23-
<Style TargetType="{x:Type Button}">
24-
<!-- "<Setter Property="IsEnabled" Value="False" /> -->
25-
</Style>
26-
</Button.Style>
27-
28-
</Button>
21+
<Grid HorizontalAlignment="Left" Width="346">
22+
<Label HorizontalAlignment="Left" Content="Not Signed" Margin="0" x:Name="UserName" Width="261" Height="30"/>
23+
<Button HorizontalAlignment="Right" Content="Sign In" Margin="0" Click="SignIn" x:Name="SignInButton" Width="80" Height="30">
24+
<Button.Style>
25+
<Style TargetType="{x:Type Button}">
26+
<!-- "<Setter Property="IsEnabled" Value="False" /> -->
27+
</Style>
28+
</Button.Style>
29+
</Button>
30+
</Grid>
2931
<GroupBox Margin="0,0,0,0" Header="Create a To Do item">
3032

3133
<Grid Margin="0" HorizontalAlignment="Left" Width="388" >

0 commit comments

Comments
 (0)