Skip to content

Commit 82236f0

Browse files
committed
2 parents 4e1066e + e6712d3 commit 82236f0

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

Diff for: 2-WebApp-graph-user/2-6-BFF-Proxy/AppCreationScripts/Configure-WithCertificates.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ Function ConfigureApplications
319319
Write-Host "Successfully registered and configured that app registration for 'CallGraphBFF' at `n $clientPortalUrl" -ForegroundColor Green
320320

321321
# Update config file for 'client'
322-
# $configFile = $pwd.Path + "\..\CallGraphBFF\appsettings.json"
323-
$configFile = $(Resolve-Path ($pwd.Path + "\..\CallGraphBFF\appsettings.json"))
322+
# $configFile = $pwd.Path + "\..\appsettings.json"
323+
$configFile = $(Resolve-Path ($pwd.Path + "\..\appsettings.json"))
324324

325325
$dictionary = @{ "Enter_the_Tenant_Id_Here" = $tenantId;"Enter_the_Application_Id_Here" = $clientAadApplication.AppId;"Enter_the_Client_Secret_Here" = $clientAppKey };
326326

Diff for: 2-WebApp-graph-user/2-6-BFF-Proxy/AppCreationScripts/Configure.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ Function ConfigureApplications
301301
Write-Host "Successfully registered and configured that app registration for 'CallGraphBFF' at `n $clientPortalUrl" -ForegroundColor Green
302302

303303
# Update config file for 'client'
304-
# $configFile = $pwd.Path + "\..\CallGraphBFF\appsettings.json"
305-
$configFile = $(Resolve-Path ($pwd.Path + "\..\CallGraphBFF\appsettings.json"))
304+
# $configFile = $pwd.Path + "\..\appsettings.json"
305+
$configFile = $(Resolve-Path ($pwd.Path + "\..\appsettings.json"))
306306

307307
$dictionary = @{ "Enter_the_Tenant_Id_Here" = $tenantId;"Enter_the_Application_Id_Here" = $clientAadApplication.AppId;"Enter_the_Client_Secret_Here" = $clientAppKey };
308308

Diff for: 2-WebApp-graph-user/2-6-BFF-Proxy/AppCreationScripts/sample.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"HomePage": "https://localhost:7000",
2828
"ReplyUrls": "https://localhost:7000/api/auth/signin-oidc, https://localhost:7000/api/auth/signout-oidc",
2929
"SDK": "MicrosoftIdentityWeb",
30-
"SampleSubPath": "2-WebApp-graph-user\\2-6-BFF-Proxy\\CallGraphBFF",
30+
"SampleSubPath": "2-WebApp-graph-user\\2-6-BFF-Proxy",
3131
"PasswordCredentials": "Auto",
3232
"Certificate": "Auto",
3333
"RequiredResourcesAccess": [
@@ -49,7 +49,7 @@
4949
{
5050
"App": "client",
5151
"SettingKind": "Replace",
52-
"SettingFile": "\\..\\CallGraphBFF\\appsettings.json",
52+
"SettingFile": "\\..\\appsettings.json",
5353
"Mappings": [
5454
{
5555
"key": "Enter_the_Tenant_Id_Here",

Diff for: 2-WebApp-graph-user/2-6-BFF-Proxy/README-use-certificate.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Finally, you need to modify the app's configuration files.
147147

148148
> Perform the steps below for the client app (CallGraphBFF)
149149
150-
1. Open the `CallGraphBFF\appsettings.json` file.
150+
1. Open the `appsettings.json` file.
151151
2. *Comment out* the next line:
152152

153153
```json
@@ -174,7 +174,7 @@ You can now start the application as instructed in the [README](./README#setup-t
174174

175175
> Perform the steps below for the client app (CallGraphBFF)
176176
177-
1. Open the `CallGraphBFF\appsettings.json` file.
177+
1. Open the `appsettings.json` file.
178178
2. *Comment out* the next line:
179179

180180
```json

Diff for: 2-WebApp-graph-user/2-6-BFF-Proxy/README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ or download and extract the repository *.zip* file.
8585
### Step 2: Navigate to project folder
8686

8787
```console
88-
cd 2-WebApp-graph-user/2-6-BFF-Proxy/CallGraphBFF
88+
cd 2-WebApp-graph-user/2-6-BFF-Proxy
8989
```
9090

9191
### Step 3. Trust development certificates
@@ -183,7 +183,7 @@ Open the project in your IDE (like Visual Studio or Visual Studio Code) to confi
183183

184184
> In the steps below, "ClientID" is the same as "Application ID" or "AppId".
185185
186-
1. Open the `2-6-BFF-Proxy/CallGraphBFF/appsettings.json` file.
186+
1. Open the `2-6-BFF-Proxy/appsettings.json` file.
187187
1. Find the string `Enter_the_Tenant_Id_Here` and replace it with your Microsoft Entra tenant/directory ID.
188188
1. Find the string `Enter_the_Application_Id_Here` and replace it with the application ID (clientId) of `CallGraphBFF` app copied from the Microsoft Entra admin center.
189189
1. Find the string `Enter_the_Client_Secret_Here` and replace it with the generated secret that you saved during the creation of `CallGraphBFF` copied from the Microsoft Entra admin center.
@@ -193,7 +193,7 @@ Open the project in your IDE (like Visual Studio or Visual Studio Code) to confi
193193
From your shell or command line, execute the following commands:
194194

195195
```console
196-
cd 2-WebApp-graph-user/2-6-BFF-Proxy/CallGraphBFF
196+
cd 2-WebApp-graph-user/2-6-BFF-Proxy/
197197
dotnet run
198198
```
199199

@@ -227,7 +227,7 @@ To provide feedback on or suggest features for Microsoft Entra ID, visit [User V
227227

228228
### Login and logout
229229

230-
In [Program.cs](./CallGraphBFF/Program.cs), **Microsoft Identity Web** service is configured to obtain tokens to call downstream web APIs (here, Microsoft Graph):
230+
In [Program.cs](./Program.cs), **Microsoft Identity Web** service is configured to obtain tokens to call downstream web APIs (here, Microsoft Graph):
231231

232232
```csharp
233233
// Add Microsoft.Identity.Web services to the container.
@@ -237,7 +237,7 @@ builder.Services.AddMicrosoftIdentityWebAppAuthentication(builder.Configuration)
237237
.AddInMemoryTokenCaches();
238238
```
239239

240-
On the frontend side, the React SPA uses the [AuthProvider HOC](./CallGraphBFF/ClientApp/src/AuthProvider.js), which makes a GET call to the `/api/auth/login` endpoint of the ASP.NET Core web app.
240+
On the frontend side, the React SPA uses the [AuthProvider HOC](./ClientApp/src/AuthProvider.js), which makes a GET call to the `/api/auth/login` endpoint of the ASP.NET Core web app.
241241

242242
```javascript
243243
login = (postLoginRedirectUri) => {
@@ -255,7 +255,7 @@ login = (postLoginRedirectUri) => {
255255
}
256256
```
257257

258-
The controller in [AuthController.cs](./CallGraphBFF/Controllers/AuthController.cs) processes the request and initiates a token request against Microsoft Entra ID via the `Challenge()` method:
258+
The controller in [AuthController.cs](./Controllers/AuthController.cs) processes the request and initiates a token request against Microsoft Entra ID via the `Challenge()` method:
259259

260260
```csharp
261261
[HttpGet("login")]
@@ -274,7 +274,7 @@ Once the authentication is successful, the authentication state can be shared wi
274274

275275
### Cookie policies
276276

277-
The sample makes use of HTTP only, strict cookies to secure the calls between the frontend and the backend. The default ASP.NET Core authentication cookie behavior will attempt to redirect unauthenticated requests to the identity provider (in this case, Microsoft Entra ID). As this is not the desired behavior in BFF proxy architecture, custom cookie authenticated events is used to modify the default behavior (see [CustomCookieAuthenticationEvents.cs](./CallGraphBFF/Utils/CustomCookieAuthenticationEvents.cs)).
277+
The sample makes use of HTTP only, strict cookies to secure the calls between the frontend and the backend. The default ASP.NET Core authentication cookie behavior will attempt to redirect unauthenticated requests to the identity provider (in this case, Microsoft Entra ID). As this is not the desired behavior in BFF proxy architecture, custom cookie authenticated events is used to modify the default behavior (see [CustomCookieAuthenticationEvents.cs](./Utils/CustomCookieAuthenticationEvents.cs)).
278278

279279
```csharp
280280
// Configure cookie properties for ASP.NET Core cookie authentication.
@@ -298,7 +298,7 @@ Microsoft Graph is now CAE-enabled in Preview. This means that it can ask its cl
298298

299299
#### Declare the CAE capability in the configuration
300300

301-
This sample app declares that it's CAE-capable by adding the `ClientCapabilities` field to the configuration in [appsettings.json](./CallGraphBFF/appsettings.json):
301+
This sample app declares that it's CAE-capable by adding the `ClientCapabilities` field to the configuration in [appsettings.json](./appsettings.json):
302302

303303
```json
304304
{
@@ -362,7 +362,7 @@ For more details on what's inside the access token, clients should use the token
362362

363363
### Calling Microsoft Graph
364364

365-
To make bearer token calls to the Microsoft Graph API, **Microsoft.Identity.Web** makes use of the Microsoft Graph SDK internally. This is shown in [Program.cs](./CallGraphBFF/Program.cs):
365+
To make bearer token calls to the Microsoft Graph API, **Microsoft.Identity.Web** makes use of the Microsoft Graph SDK internally. This is shown in [Program.cs](./Program.cs):
366366

367367
```csharp
368368
// Add services to the container.
@@ -372,7 +372,7 @@ builder.Services.AddMicrosoftIdentityWebAppAuthentication(builder.Configuration)
372372
.AddInMemoryTokenCaches();
373373
```
374374

375-
The service can then be injected into controllers to make Graph calls afterwards. See [ProfileController.cs](./CallGraphBFF/Controllers/ProfileController.cs) for more.
375+
The service can then be injected into controllers to make Graph calls afterwards. See [ProfileController.cs](./Controllers/ProfileController.cs) for more.
376376

377377
### Deploying Web app to Azure App Service
378378

0 commit comments

Comments
 (0)