Skip to content

Commit 65efdc7

Browse files
authored
Revise "Enforce authentication #nm2"
Clarified the explanation of `default` user authentication and updated example usage for better understanding.
1 parent 74ddac4 commit 65efdc7

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

stage_descriptions/auth-07-nm2.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
In this stage, you'll add support for enforcing authentication for the `default` user.
22

3-
### Enforcing `default` user authentication
3+
### Enforcing `default` User Authentication
44

5-
By default, every new connection is 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.
66

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:
810

911
```bash
1012
# Client 1
11-
$ redis-cli
12-
> ACL SETUSER default >password
13+
$ redis-cli ACL SETUSER default >password
1314
OK
1415

1516
# This connection remains authenticated as the default user
@@ -18,11 +19,12 @@ OK
1819

1920
# Client 2
2021
# This connection is not authenticated
21-
$ redis-cli
22-
> ACL WHOAMI
22+
$ redis-cli ACL WHOAMI
2323
(error) NOAUTH Authentication required.
2424
```
2525

26+
When an unauthenticated connection tries to execute a command, return the simple error: `NOAUTH Authentication required.`
27+
2628
### Tests
2729

2830
The tester will execute your program like this:
@@ -31,7 +33,7 @@ The tester will execute your program like this:
3133
$ ./your_program.sh
3234
```
3335

34-
It'll then send commands to two different clients.
36+
It will then send commands to two different clients:
3537

3638
```bash
3739
# Client 1
@@ -51,9 +53,6 @@ $ redis-cli
5153
(error) NOAUTH Authentication required.
5254
```
5355

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

Comments
 (0)