Skip to content

Commit ac40233

Browse files
author
Kalyan Krishna
committed
Copied from the active-directory-dotnet-native-aspnetcore-v2\2. Web API now calls Microsoft Graph.
Do not link from Home page yet
1 parent c358da6 commit ac40233

29 files changed

+2485
-5
lines changed

3-WebApp-multi-APIs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ After the following lines in the ConfigureServices(IServiceCollection services)
8989
.AddInMemoryTokenCache();
9090
services.AddHttpClient<IArmOperations, ArmApiOperationService>();
9191
```
92+
9293
This enables to add the Azure Resource manager micro-service to use the HttpClient by dependency injection.
9394

9495
### Add the `Services\ARM` sub folder

3-WebApp-multi-APIs/appsettings.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
{
1+
{
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": "kkaad.onmicrosoft.com",
5+
"TenantId": "979f4440-75dc-4664-b2e1-2cafa0ac67d1",
6+
"ClientId": "0e5d5b34-0ad1-4c5b-81a3-0ca9173c937b",
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": "88zmwILH261wDgLOdaUzcM145WF6bkVPkJvhXpJTSIU="
1212

1313
},
1414
"Logging": {
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"Sample": {
3+
"Title": "A WPF application that calls a Web API running on ASP.NET Core 2.0 protected by Azure AD using OAuth 2.0 access tokens. ",
4+
"Level": 200,
5+
"Client": ".NET Desktop (WPF)",
6+
"Service": "ASP.NET Core Web API",
7+
"RepositoryUrl": "active-directory-dotnet-native-aspnetcore-v2",
8+
"Endpoint": "AAD v2.0"
9+
},
10+
11+
/*
12+
This section describes the Azure AD Applications to configure, and their dependencies
13+
*/
14+
"AADApps": [
15+
{
16+
"Id": "service",
17+
"Name": "TodoListService (active-directory-dotnet-native-aspnetcore-v2)",
18+
"Kind": "WebApi",
19+
"HomePage": "https://localhost:44351/",
20+
"PasswordCredentials": "Auto",
21+
"RequiredResourcesAccess": [
22+
{
23+
"Resource": "Microsoft Graph",
24+
"DelegatedPermissions": [ "User.Read" ]
25+
}
26+
],
27+
"ManualSteps": [
28+
{
29+
"Comment": "Navigate to the Manifest page and change 'signInAudience' to 'AzureADandPersonalMicrosoftAccount'."
30+
},
31+
{
32+
"Comment": "[Optional] If you are a tenant admin, you can navigate to the API Permisions page and select 'Grant admin consent for (your tenant)'"
33+
}
34+
]
35+
},
36+
{
37+
"Id": "client",
38+
"Name": "TodoListClient (active-directory-dotnet-native-aspnetcore-v2)",
39+
"Kind": "Desktop",
40+
"RequiredResourcesAccess": [
41+
{
42+
"Resource": "service",
43+
"DelegatedPermissions": [ "user_impersonation" ]
44+
}
45+
],
46+
"ManualSteps": [
47+
{
48+
"Comment": "Navigate to the Manifest page and change 'signInAudience' to 'AzureADandPersonalMicrosoftAccount'."
49+
}
50+
]
51+
}
52+
],
53+
54+
/*
55+
This section describes how to update the code in configuration files from the apps coordinates, once the apps
56+
are created in Azure AD.
57+
Each section describes a configuration file, for one of the apps, it's type (XML, JSon, plain text), its location
58+
with respect to the root of the sample, and the mappping (which string in the config file is mapped to which value
59+
*/
60+
"CodeConfiguration": [
61+
{
62+
"App": "service",
63+
"SettingKind": "Text",
64+
"SettingFile": "\\..\\TodoListService\\appsettings.json",
65+
"Mappings": [
66+
{
67+
"key": "Domain",
68+
"value": "$tenantName"
69+
},
70+
{
71+
"key": "TenantId",
72+
"value": "$tenantId"
73+
},
74+
{
75+
"key": "ClientId",
76+
"value": "service.AppId"
77+
},
78+
{
79+
"key": "ClientSecret",
80+
"value": "service.AppKey"
81+
}
82+
]
83+
},
84+
85+
{
86+
"App": "client",
87+
"SettingKind": "XML",
88+
"SettingFile": "\\..\\TodoListClient\\App.Config",
89+
"Mappings": [
90+
//{
91+
// "key": "ida:Tenant",
92+
// "value": "$tenantName"
93+
//},
94+
{
95+
"key": "ida:ClientId",
96+
"value": ".AppId"
97+
},
98+
{
99+
"key": "todo:TodoListScope",
100+
"value": "service.Scope"
101+
},
102+
{
103+
"key": "todo:TodoListBaseAddress",
104+
"value": "service.HomePage"
105+
}
106+
]
107+
}
108+
]
109+
}

0 commit comments

Comments
 (0)