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 responding to the `AUTH` command.
1
+
In this stage, you'll add support for the `AUTH` command.
2
2
3
-
### The `AUTH`command
3
+
### The `AUTH`Command
4
4
5
-
The [`AUTH`](https://redis.io/docs/latest/commands/auth/) command is used to authenticate the current connection with the specified user.
5
+
The [`AUTH`](https://redis.io/docs/latest/commands/auth/) command authenticates the current connection with a specified username and password.
6
6
7
-
Example usage:
7
+
The command format is:
8
+
9
+
```bash
10
+
AUTH <username><password>
11
+
```
12
+
13
+
For example:
8
14
9
15
```bash
10
16
# Authentication failure
@@ -16,11 +22,11 @@ Example usage:
16
22
OK
17
23
```
18
24
19
-
The `AUTH` command responds with `+OK\r\n` if the specified password's hash matches with any of the hashes in the user's password list.
25
+
The server responds with `+OK\r\n` if the specified password's hash matches any of the hashes in the user's password list.
20
26
21
-
In case of wrong password, the response is a RESP simple error `WRONGPASS invalid username-password pair or user is disabled.`.
27
+
If no match is found, the server responds with the [RESP simple error](https://redis.io/docs/latest/develop/reference/protocol-spec/#simple-errors):`WRONGPASS invalid username-password pair or user is disabled.`
22
28
23
-
In this stage, you just need to respond to the `AUTH` command appropriately. You don't actually need to authenticate the connection. We'll get to that in the later stages.
29
+
For this stage, you just need to respond to the `AUTH` command appropriately. You don't need to actually authenticate the connection. We'll get to that in later stages.
24
30
25
31
### Tests
26
32
@@ -30,18 +36,16 @@ The tester will execute your program like this:
30
36
$ ./your_program.sh
31
37
```
32
38
33
-
It'll then send a`ACL SETUSER` command, specifying the `default` user and a password.
39
+
It will then send an`ACL SETUSER` command, specifying the `default` user and a password:
34
40
35
41
```bash
36
-
$ redis-cli
37
-
# Expect: +OK\r\n
38
-
> ACL SETUSER default >mypassword
42
+
$ redis-cli ACL SETUSER default >mypassword
39
43
OK
40
44
```
41
45
42
-
The tester will validate that the response to the `ACL SETUSER` command is `+OK\r\n`.
46
+
Your server should respond with `OK` encoded as a simple string (`+OK\r\n`).
43
47
44
-
It'll then send two `AUTH` commands, specifying the `default` user. First, it'll send a wrong password. Next, it'll send the correct password.
48
+
Next, the tester will send two `AUTH` commands: one with a wrong password and another with a correct password.
45
49
46
50
```bash
47
51
# Expect error starting with: WRONGPASS
@@ -53,13 +57,12 @@ It'll then send two `AUTH` commands, specifying the `default` user. First, it'll
53
57
OK
54
58
```
55
59
56
-
The tester will validate the following for the responses to the `AUTH` command:
57
-
58
-
- In case of incorrect password, the response is a RESP simple error starting with the string `WRONGPASS`.
59
-
- In case of correct password, the response is `+OK\r\n`.
60
+
The tester will verify that:
61
+
- Wrong passwords return a [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec/#simple-errors) starting with `WRONGPASS`.
62
+
- Correct passwords return `+OK\r\n`.
60
63
61
64
### Notes
62
65
63
-
- The tester will be lenient in checking error messages. Any authentication failure starting with `WRONGPASS` is valid. For example,
66
+
- The tester will be lenient in checking error messages. Any authentication failure starting with `WRONGPASS` is valid. For example:
0 commit comments