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
In this stage, you'll add support for enforcing authentication for the `default` user.
2
2
3
-
### Enforcing `default`user authentication
3
+
### Enforcing `default`User Authentication
4
4
5
-
By default, every new connectionis automatically authenticated as the `default` user. This is because the `nopass` flag is set for the `default` user from the start. However, after clearing this flag (by setting a password for the `default` user), new connections are not automatically authenticated as the `default` user. Connections which have already been authenticated will remain authenticated.
5
+
When you create a new connection, it is automatically authenticated as the `default` user. This happens because the `nopass` flag is set for the `default` user from the start.
6
6
7
-
Example usage:
7
+
Once you set a password for the `default` user, new connections will no longer be automatically authenticated. However, any connections that were already authenticated will stay logged in.
8
+
9
+
For example:
8
10
9
11
```bash
10
12
# Client 1
11
-
$ redis-cli
12
-
> ACL SETUSER default >password
13
+
$ redis-cli ACL SETUSER default >password
13
14
OK
14
15
15
16
# This connection remains authenticated as the default user
@@ -18,11 +19,12 @@ OK
18
19
19
20
# Client 2
20
21
# This connection is not authenticated
21
-
$ redis-cli
22
-
> ACL WHOAMI
22
+
$ redis-cli ACL WHOAMI
23
23
(error) NOAUTH Authentication required.
24
24
```
25
25
26
+
When an unauthenticated connection tries to execute a command, return the simple error: `NOAUTH Authentication required.`
27
+
26
28
### Tests
27
29
28
30
The tester will execute your program like this:
@@ -31,7 +33,7 @@ The tester will execute your program like this:
31
33
$ ./your_program.sh
32
34
```
33
35
34
-
It'll then send commands to two different clients.
36
+
It will then send commands to two different clients:
35
37
36
38
```bash
37
39
# Client 1
@@ -51,9 +53,6 @@ $ redis-cli
51
53
(error) NOAUTH Authentication required.
52
54
```
53
55
54
-
The tester will validate the following:
55
-
56
-
1. The first client (Client 1) is still authenticated as the `default` user.
57
-
58
-
2. A second client (Client 2) receives a `NOAUTH` error when attempting to execute commands without authentication.
59
-
- This is because after we set the password for the `default` user, the `nopass` flag is also cleared. This disables auto-authentication of new users as the `default` user.
56
+
The tester will verify that:
57
+
- Client 1 can still execute commands and remains authenticated as the `default` user.
58
+
- Client 2 receives a `NOAUTH` error when trying to execute commands without authentication.
0 commit comments