|
1 | | -/* |
2 | | - * Copyright (c) Microsoft Corporation. All rights reserved. |
3 | | - * Licensed under the MIT License. |
4 | | - */ |
5 | | - |
6 | | -require('dotenv').config(); |
7 | | - |
8 | | -const TENANT_SUBDOMAIN = process.env.TENANT_SUBDOMAIN || 'Enter_the_Tenant_Subdomain_Here'; |
9 | | -const REDIRECT_URI = process.env.REDIRECT_URI || 'http://localhost:3000/auth/redirect'; |
10 | | -const POST_LOGOUT_REDIRECT_URI = process.env.POST_LOGOUT_REDIRECT_URI || 'http://localhost:3000'; |
11 | | - |
12 | | -/** |
13 | | - * Configuration object to be passed to MSAL instance on creation. |
14 | | - * For a full list of MSAL Node configuration parameters, visit: |
15 | | - * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/configuration.md |
16 | | - */ |
17 | | -const msalConfig = { |
18 | | - auth: { |
19 | | - clientId: process.env.CLIENT_ID || 'Enter_the_Application_Id_Here', // 'Application (client) ID' of app registration in Microsoft Entra admin center - this value is a GUID |
20 | | - authority: process.env.AUTHORITY || `https://${TENANT_SUBDOMAIN}.ciamlogin.com/`, // Replace the placeholder with your tenant subdomain |
21 | | - clientSecret: process.env.CLIENT_SECRET || 'Enter_the_Client_Secret_Here', // Client secret generated from the app registration in Microsoft Entra admin center |
22 | | - }, |
23 | | - system: { |
24 | | - loggerOptions: { |
25 | | - loggerCallback(loglevel, message, containsPii) { |
26 | | - console.log(message); |
27 | | - }, |
28 | | - piiLoggingEnabled: false, |
29 | | - logLevel: 'Info', |
30 | | - }, |
31 | | - }, |
32 | | -}; |
33 | | - |
34 | | -const toDoListReadScope = process.env.TODOLIST_READ || 'api://Enter_the_Web_Api_Application_Id_Here/ToDoList.Read'; |
35 | | -const toDoListReadWriteScope = process.env.TODOLIST_READWRITE || 'api://Enter_the_Web_Api_Application_Id_Here/ToDoList.ReadWrite'; |
36 | | - |
37 | | -const protectedResources = { |
38 | | - toDoListAPI: { |
39 | | - endpoint: 'https://localhost:44351/api/todolist', |
40 | | - scopes: { |
41 | | - read: [toDoListReadScope], |
42 | | - write: [toDoListReadWriteScope], |
43 | | - }, |
44 | | - }, |
45 | | -}; |
46 | | - |
47 | | -module.exports = { |
48 | | - msalConfig, |
49 | | - protectedResources, |
50 | | - TENANT_SUBDOMAIN, |
51 | | - REDIRECT_URI, |
52 | | - POST_LOGOUT_REDIRECT_URI, |
53 | | -}; |
| 1 | +/* |
| 2 | + * Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | + * Licensed under the MIT License. |
| 4 | + */ |
| 5 | + |
| 6 | +require('dotenv').config(); |
| 7 | + |
| 8 | +const TENANT_SUBDOMAIN = process.env.TENANT_SUBDOMAIN || 'Enter_the_Tenant_Subdomain_Here'; |
| 9 | +const REDIRECT_URI = process.env.REDIRECT_URI || 'http://localhost:3000/auth/redirect'; |
| 10 | +const POST_LOGOUT_REDIRECT_URI = process.env.POST_LOGOUT_REDIRECT_URI || 'http://localhost:3000'; |
| 11 | + |
| 12 | +/** |
| 13 | + * Configuration object to be passed to MSAL instance on creation. |
| 14 | + * For a full list of MSAL Node configuration parameters, visit: |
| 15 | + * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/configuration.md |
| 16 | + */ |
| 17 | +const msalConfig = { |
| 18 | + auth: { |
| 19 | + clientId: process.env.CLIENT_ID || 'Enter_the_Application_Id_Here', // 'Application (client) ID' of app registration in Microsoft Entra admin center - this value is a GUID |
| 20 | + authority: process.env.AUTHORITY || `https://${TENANT_SUBDOMAIN}.ciamlogin.com/`, // Replace the placeholder with your tenant subdomain |
| 21 | + clientSecret: process.env.CLIENT_SECRET || 'Enter_the_Client_Secret_Here', // Client secret generated from the app registration in Microsoft Entra admin center |
| 22 | + }, |
| 23 | + system: { |
| 24 | + loggerOptions: { |
| 25 | + loggerCallback(loglevel, message, containsPii) { |
| 26 | + console.log(message); |
| 27 | + }, |
| 28 | + piiLoggingEnabled: false, |
| 29 | + logLevel: 'Info', |
| 30 | + }, |
| 31 | + }, |
| 32 | +}; |
| 33 | + |
| 34 | +const toDoListReadScope = process.env.TODOLIST_READ || 'api://Enter_the_Web_Api_Application_Id_Here/ToDoList.Read'; |
| 35 | +const toDoListReadWriteScope = process.env.TODOLIST_READWRITE || 'api://Enter_the_Web_Api_Application_Id_Here/ToDoList.ReadWrite'; |
| 36 | + |
| 37 | +const protectedResources = { |
| 38 | + toDoListAPI: { |
| 39 | + endpoint: 'https://localhost:44351/api/todolist', |
| 40 | + scopes: { |
| 41 | + read: [toDoListReadScope], |
| 42 | + write: [toDoListReadWriteScope], |
| 43 | + }, |
| 44 | + }, |
| 45 | +}; |
| 46 | + |
| 47 | +module.exports = { |
| 48 | + msalConfig, |
| 49 | + protectedResources, |
| 50 | + TENANT_SUBDOMAIN, |
| 51 | + REDIRECT_URI, |
| 52 | + POST_LOGOUT_REDIRECT_URI, |
| 53 | +}; |
0 commit comments