Skip to content

Commit c6f4f62

Browse files
committed
Code Comment
1 parent 5813ff2 commit c6f4f62

File tree

12 files changed

+400
-41
lines changed

12 files changed

+400
-41
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ Please add an 'x' for the scenario(s) where you found an issue
2727
1. [ ] With specific token caches: [2-WebApp-graph-user/2-2-TokenCache](../blob/master/2-WebApp-graph-user/2-2-TokenCache)
2828
1. [ ] Calling Microsoft Graph in national clouds: [2-WebApp-graph-user/2-4-Sovereign-Call-MSGraph](../blob/master/2-WebApp-graph-user/2-4-Sovereign-Call-MSGraph)
2929
1. [ ] Web app calling several APIs [3-WebApp-multi-APIs](../blob/master/3-WebApp-multi-APIs)
30-
1. [ ] Web app calling your own Web API [4-WebApp-your-API](../blob/master/4-WebApp-your-API)
30+
1. [ ] Web app calling your own Web API
31+
1. [ ] with a work and school account in your organization: [4-WebApp-your-API/4-1-MyOrg](../blob/master/4-WebApp-your-API/4-1-MyOrg)
32+
1. [ ] with B2C users: [4-WebApp-your-API/4-2-B2C](../blob/master/4-WebApp-your-API/4-2-B2C)
33+
1. [ ] with any work and school account: [4-WebApp-your-API/4-3-AnyOrg](../blob/master/4-WebApp-your-API/4-3-AnyOrg)
3134
1. Web app restricting users
3235
1. [ ] by Roles: [5-WebApp-AuthZ/5-1-Roles](../blob/master/5-WebApp-AuthZ/5-1-Roles)
3336
1. [ ] by Groups: [5-WebApp-AuthZ/5-2-Groups](../blob/master/5-WebApp-AuthZ/5-2-Groups)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<html><body><table>
2+
<thead><tr><th>Application</th><th>AppId</th><th>Url in the Azure portal</th></tr></thead><tbody>
3+
<tr><td>webApp</td><td>533843a1-3f30-4e5b-8800-7d974c29837e</td><td><a href='https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/CallAnAPI/appId/533843a1-3f30-4e5b-8800-7d974c29837e/objectId/fe605bc2-667f-4f18-b534-eb243eb686b1/isMSAApp/'>WebApp</a></td></tr>
4+
</tbody></table></body></html>

4-WebApp-your-API/4-3-AnyOrg/ToDoListClient/appsettings.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"AzureAd": {
33
"Instance": "https://login.microsoftonline.com/",
4-
"Domain": "[Enter the domain of your tenant, e.g. contoso.onmicrosoft.com]",
4+
"Domain": "msFreeTenant.onmicrosoft.com",
55
"TenantId": "common",
6-
"ClientId": "[Enter the Client Id (Application ID obtained from the Azure portal), e.g. ba74781c2-53c2-442a-97c2-3d60re42f403]",
7-
"ClientSecret": "[Copy the client secret added to the app from the Azure portal]",
6+
"ClientId": "176b110b-80ce-4943-8fb7-3b19fe210d46",
7+
"ClientSecret": "3W/iqNToW00tW7bt358jPMNXeZ4Icn/w9QxjP8ZWQxA=",
88
"CallbackPath": "/signin-oidc",
99
"SignedOutCallbackPath": "/signout-callback-oidc"
1010
},
@@ -17,15 +17,15 @@
1717
},
1818
"TodoList": {
1919
/*
20-
TodoListScope is the scope of the Web API you want to call. This can be: "api://b10faa7f-02e8-451c-a405-2a7e9e7072f0/.default",
20+
TodoListScope is the scope of the Web API you want to call. This can be: "api://0892ebc9-a57e-4b64-814f-4bd0798f8132/.default",
2121
- a scope for a V2 application (for instance api://b3682cc7-8b30-4bd2-aaba-080c6bf0fd31/access_as_user)
2222
- a scope corresponding to a V1 application (for instance <GUID>/user_impersonation, where <GUID> is the
2323
clientId of a V1 application, created in the https://portal.azure.com portal.
2424
*/
25-
"TodoListAppId": "[Enter_client_ID_Of_TodoListService-v2_from_Azure_Portal,_e.g._2ec40e65-ba09-4853-bcde-bcb60029e596",
26-
"TodoListScope": "api://[Enter_client_ID_Of_TodoListService-v2_from_Azure_Portal,_e.g._2ec40e65-ba09-4853-bcde-bcb60029e596]/.default",
25+
"TodoListAppId": "0892ebc9-a57e-4b64-814f-4bd0798f8132",
26+
"TodoListScope": "api://0892ebc9-a57e-4b64-814f-4bd0798f8132/.default",
2727
//api://83ade765-7b4f-4208-b69f-c28a2b4bebec/.default",
28-
"TodoListBaseAddress": "https://localhost:44351",
28+
"TodoListBaseAddress": "https://localhost:44351/",
2929
"AdminConsentRedirectApi": "https://localhost:44351/api/Home"
3030
},
3131
"RedirectUri": "https://localhost:44321/",

4-WebApp-your-API/4-3-AnyOrg/TodoListService/Controllers/TodoListController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,16 @@ private bool TodoItemExists(int id)
164164
}
165165
public async Task<List<string>> CallGraphApiOnBehalfOfUser()
166166
{
167-
string[] scopes = { "user.read.all" };
167+
string[] scopes = { "user.read" };
168168

169169
// we use MSAL.NET to get a token to call the API On Behalf Of the current user
170170
try
171171
{
172172
List<string> userList = new List<string>();
173173
string accessToken = await _tokenAcquisition.GetAccessTokenForUserAsync(scopes);
174-
IEnumerable<User> users = await CallGraphApiOnBehalfOfUser(accessToken);
175-
userList = users.Select(x => x.UserPrincipalName).ToList();
176-
return userList;
174+
//IEnumerable<User> users = await CallGraphApiOnBehalfOfUser(accessToken);
175+
//userList = users.Select(x => x.UserPrincipalName).ToList();
176+
return null;
177177
}
178178
catch (MsalUiRequiredException ex)
179179
{

4-WebApp-your-API/4-3-AnyOrg/TodoListService/appsettings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"AzureAd": {
33
"Instance": "https://login.microsoftonline.com/",
4-
"Domain": "[Enter the domain of your tenant, e.g. contoso.onmicrosoft.com]",
4+
"Domain": "msFreeTenant.onmicrosoft.com",
55
"TenantId": "common",
6-
"ClientId": "[Enter the Client Id (Application ID obtained from the Azure portal), e.g. ba74781c2-53c2-442a-97c2-3d60re42f403]",
7-
"ClientSecret": "[Copy the client secret added to the app from the Azure portal]",
6+
"ClientId": "0892ebc9-a57e-4b64-814f-4bd0798f8132",
7+
"ClientSecret": "rZ0TVcb901KRnDQ4TEcvdPuxr2ABimk80Mg4nV8Tl4o=",
88
"GraphAPI": "https://graph.microsoft.com/v1.0"
99
},
1010
"https_port": 44351,

5-WebApp-AuthZ/5-1-Roles/appsettings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"AzureAd": {
33
"Instance": "https://login.microsoftonline.com/",
4-
"Domain": "[Enter the domain of your tenant, e.g. contoso.onmicrosoft.com]",
5-
"TenantId": "[Enter 'common', or 'organizations' or the Tenant Id (Obtained from the Azure portal. Select 'Endpoints' from the 'App registrations' blade and use the GUID in any of the URLs), e.g. da41245a5-11b3-996c-00a8-4d99re19f292]",
6-
"ClientId": "[Enter the Client Id (Application ID obtained from the Azure portal), e.g. ba74781c2-53c2-442a-97c2-3d60re42f403]",
4+
"Domain": "ms0604.onmicrosoft.com",
5+
"TenantId": "d963c147-dc13-433f-9520-6db1ff177c34",
6+
"ClientId": "42d382ca-83ad-4384-b7ca-c732d90be3f2",
77
"CallbackPath": "/signin-oidc",
88
"SignedOutCallbackPath ": "/signout-callback-oidc",
99

1010
// To call an API
11-
"ClientSecret": "[Copy the client secret added to the app from the Azure portal]"
11+
"ClientSecret": "Ne_h-tm_5oT6k5B_IM17_WNp.RItqTb.-E"
1212
},
1313
"Logging": {
1414
"LogLevel": {

0 commit comments

Comments
 (0)