You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
8
8
---
9
9
10
-
This project illustrates a simple wrapper around **MSAL Node**[ConfidentialClientApplication](https://azuread.github.io/microsoft-authentication-library-for-js/ref/classes/_azure_msal_node.confidentialclientapplication.html) class in order to streamline routine authentication tasks such as login, logout and token acquisition, as well as securing routes and protecting resources.
10
+
This project illustrates a simple wrapper around the [ConfidentialClientApplication](https://azuread.github.io/microsoft-authentication-library-for-js/ref/classes/_azure_msal_node.confidentialclientapplication.html) class of the [Microsoft Authentication Library for Node.js](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node#microsoft-authentication-library-for-node-msal-node) (MSAL Node), in order to streamline routine authentication tasks such as login, logout and token acquisition, as well as securing routes and controlling access.
11
11
12
12
This is an open source project. [Suggestions](https://github.com/Azure-Samples/msal-express-wrapper/issues/new) and [contributions](https://github.com/Azure-Samples/msal-express-wrapper/blob/dev/CONTRIBUTING.md) are welcome!
13
13
@@ -21,6 +21,8 @@ This is an open source project. [Suggestions](https://github.com/Azure-Samples/m
21
21
* (coming soon) Enable [Conditional Access](https://docs.microsoft.com/azure/active-directory/develop/v2-conditional-access-dev-guide) and [Zero-Trust](https://docs.microsoft.com/azure/active-directory/develop/developer-guide-conditional-access-authentication-context)
22
22
* (coming soon) Run custom policies with [Azure AD B2C](https://docs.microsoft.com/azure/active-directory-b2c/overview)
23
23
24
+
> :warning: Protected web API scenarios are currently not supported.
25
+
24
26
## Prerequisites
25
27
26
28
*[Node](https://nodejs.org/en/) 12 LTS or higher
@@ -128,6 +130,12 @@ app.use(router(authProvider)); // use authProvider in routers downstream
128
130
app.listen(SERVER_PORT, () =>console.log(`Server is listening on port ${SERVER_PORT}!`));
129
131
```
130
132
133
+
The wrapper stores user data on `req.session` variable. Below are some of the useful variables:
134
+
135
+
*`req.session.isAuthenticated`: indicates if user is currently authenticated (*boolean*)
136
+
*`req.session.account`: MSAL.js account object containing useful information like ID token claims (see [AccountInfo](https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#accountinfo))
137
+
*`req.session.remoteResources.{resourceName}`: Contains parameters related to an Azure AD / Azure AD B2C protected resource, including raw access tokens (see [Resource](https://azure-samples.github.io/msal-express-wrapper/docs/modules.html#resource))
138
+
131
139
### Middleware
132
140
133
141
#### Authentication
@@ -254,7 +262,7 @@ Session support in this sample is provided by the [express-session](https://www.
254
262
255
263
MSAL Node has an in-memory cache by default. The demo app also features a [persistent cache plugin](./demo/App/utils/cachePlugin.js) in order to save the cache to disk. This plugin is not meant to be production-ready. As such, you might want to implement persistent caching using a 3rd party library like [redis](https://redis.io/).
256
264
257
-
## Resources
265
+
## Information
258
266
259
267
*[Initializing a confidential client app with MSAL Node](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-node/docs/initialize-confidential-client-application.md)
0 commit comments