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
- Clients like [Node Redis](https://github.com/redis/node-redis) and [Redis om Node](https://github.com/redis/redis-om-node) help you to use Redis in Node.js applications.
3
-
-[RedisInsight](https://redis.com/redis-enterprise/redis-insight/): To view your Redis data or to play with raw Redis commands in the workbench
2
+
- Clients like [Node Redis](https://github.com/redis/node-redis) and [Redis OM Node](https://github.com/redis/redis-om-node) help you to use Redis in Node.js applications.
3
+
-[RedisInsight](https://redis.com/redis-enterprise/redis-insight/): To view your Redis data or to play with raw Redis commands in the workbench
4
4
-[Try Redis Enterprise for free](https://redis.com/try-free/)
@@ -13,32 +13,36 @@ import MobileBankingDashboardBalance from './images/demo-dashboard-balance-widge
13
13
14
14
<MobileBankingSourceCode />
15
15
16
-
## What is Mobile banking authentication and session storage?
16
+
## What is Authentication and Session Storage for Mobile Banking?
17
17
18
-
After an user has successfully entered their login credentials, mobile banking apps use an token / sessionId created by server to represent a user's identity. The token / sessionId is stored in Redis Enterprise for the duration of a user session and also sent in the login response to the banking application client (mobile/ browser). The client application then sends the token / sessionId with every request to server and server validates it before processing the request.
18
+
After a user has successfully entered their login credentials, mobile banking apps use a `token` and `sessionId` created by the server to represent a user's identity. The `token`is stored in Redis for the duration of a user session and also sent in the login response to the banking application client (mobile/ browser). The client application then sends the `token` with every request to server and server validates it before processing the request.
19
19
20
20

21
21
22
-
**Note** : Redis stack supports [JSON](/howtos/redisjson/) data type, indexing and Querying JSON and [more](https://redis.io/docs/stack/). So your Session store is not limited to simple key-value data.
22
+
:::note
23
23
24
-
The session store houses critical information related to each user as they navigate an application for the duration of their session. Mobile banking session data may include following information
24
+
Redis Stack supports the [**JSON**](/howtos/redisjson/) data type and allows you to index and querying JSON and [**more**](https://redis.io/docs/stack/). So your session store is not limited to simple key-value stringified data.
25
25
26
-
- User's profile information, such as name, date of birth, email address, etc .
27
-
- User's permissions, such as “user,” “admin,” “supervisor,” “super-admin,” etc .
28
-
- Other app-related data like recent transaction, balance etc .
29
-
- Session expiration, such as one hour from now, one week from now, etc . and more
26
+
:::
27
+
28
+
The session store houses critical information related to each user as they navigate an application for the duration of their session. Mobile banking session data may include, but is not limited to following information:
29
+
30
+
- User's profile information, such as name, date of birth, email address, etc.
31
+
- User's permissions, such as `user`, `admin`, `supervisor`, `super-admin`, etc.
32
+
- Other app-related data like recent transaction(s), balance etc.
33
+
- Session expiration, such as one hour from now, one week from now, etc.
30
34
31
-
## Why you should Redis for Mobile banking session management?
35
+
## Why you should use Redis for mobile banking session management?
32
36
33
-
-**Resilience**: Redis enterprise offers incredible resilience with **99.999% uptime**. After all, authentication token stores must provide round-the-clock availability. This ensures that users get uninterrupted, 24/7 access to their applications.
37
+
-**Resilience**: Redis Enterprise offers incredible resilience with **99.999% uptime**. After all, authentication token stores must provide round-the-clock availability. This ensures that users get uninterrupted, 24/7 access to their applications.
34
38
35
39
-**Scalability**: Token stores need to be highly scalable so that they don't become a bottleneck when a **high volume of users** authenticate at once. Redis Enterprise provides **< 1ms latency** at incredibly high throughput (up to **100MM ops/second**) which makes authentication and session data access much faster!
36
40
37
-
-**Integration with common libraries and platforms**: Since Redis open source is integrated into most session management libraries and platforms, Redis Enterprise can seamlessly integrate when upgrading from open source Redis (For eg: express-session and connect-redis-stack libraries integration is demonstrated in this tutorial)
41
+
-**Integration with common libraries and platforms**: Since Redis open source is integrated into most session management libraries and platforms, Redis Enterprise can seamlessly integrate when upgrading from open source Redis (e.g. `express-session` and [`connect-redis-stack`](https://www.npmjs.com/package/connect-redis-stack) libraries integration is demonstrated in this tutorial)
38
42
39
43
:::tip
40
44
41
-
Check our <u>[JSON Web Tokens (JWT) are Dangerous for User Sessions](https://redis.com/blog/json-web-tokens-jwt-are-dangerous-for-user-sessions/)</u> ebook for a secured session management practice.
45
+
Read our ebook that answers the question: [**Are JSON Web Tokens (JWT) Safe?**](https://redis.com/docs/json-web-tokens-jwts-are-not-safe/) It discusses when and how to safely use JWTs, with battle-tested solutions for session management.
Download <u>[RedisInsight](https://redis.com/redis-enterprise/redis-insight/)</u> to view your Redis data or to play with raw Redis commands in the workbench. learn more about <u>[RedisInsight in tutorials](/explore/redisinsight/)</u>
112
+
Download [**RedisInsight**](https://redis.com/redis-enterprise/redis-insight/) to view your Redis data or to play with raw Redis commands in the workbench. Learn more by reading the [**RedisInsight tutorial**](/explore/redisinsight/)
109
113
:::
110
114
111
115
### Session configuration
112
116
113
117
Redis is integrated into many session management libraries, We will be using [connect-redis-stack](https://www.npmjs.com/package/connect-redis-stack) library for this demo which provides Redis session storage for your
Following code illustrates configuring Redis session and it's integration with express app.
120
+
The following code illustrates configuring Redis sessions and with `express-session`.
117
121
118
122
```js title="app/server.js"
119
123
importsessionfrom'express-session';
@@ -147,9 +151,9 @@ app.listen(8080, () => console.log('Listening on port 8080'));
147
151
148
152

149
153
150
-
Let's look in to the `/perform_login` API code which is triggered on the click of Login button from [login page](http://localhost:8080/)
154
+
Let's look at the `/perform_login` API code which is triggered on the click of Login button from [login page](http://localhost:8080/)
151
155
152
-
Since [connect-redis-stack](https://www.npmjs.com/package/connect-redis-stack)session is configured in the express middleware, a session is automatically created at the at the end of the HTTP(API) response if `req.session` variable is assigned/ altered.
156
+
Since [connect-redis-stack](https://www.npmjs.com/package/connect-redis-stack) is an express middleware, a session is automatically created at the start of the request, and updated at the end of the HTTP(API) response if `req.session` variable is altered.
In above code - `session.userid` variable is assigned with a value on successful login (for bob user), so a session is created in Redis with assigned data and only Redis key (sessionId) is stored in client cookie.
179
+
In above code - `session.userid` variable is assigned with a value on successful login (for "bob" user), so a session is created in Redis with assigned data and only Redis key (sessionId) is stored in client cookie.
176
180
177
181
- Dashboard page after successful login
178
182

@@ -187,9 +191,9 @@ Now on every other API request from client, [connect-redis-stack](https://www.np
187
191
188
192
### Balance API (Session storage)
189
193
190
-
Consider below `/transaction/balance` API code to demonstrate session storage.
194
+
Consider the below `/transaction/balance` API code to demonstrate session storage.
191
195
192
-
We have to modify the `req.session` variable to add/ update session data.
196
+
We have to modify the `req.session` variable to update session data.
193
197
Let's add more session data like current balance amount of the user .
Hopefully, this tutorial has helped you visualize how to use Redis for better session management. For additional resources related to this topic, check out the links below:
238
+
Hopefully, this tutorial has helped you visualize how to use Redis for better session management, specifically in the context of mobile banking. For additional resources related to this topic, check out the links below:
235
239
236
240
### Additional resources
237
241
238
-
-[JSON Web Tokens (JWT) are Dangerous for User Sessions](https://redis.com/blog/json-web-tokens-jwt-are-dangerous-for-user-sessions/)
242
+
-[Are JSON Web Tokens (JWT) Safe?](https://redis.com/docs/json-web-tokens-jwts-are-not-safe/)
0 commit comments