Skip to content

Commit 0802d0b

Browse files
authored
Merge pull request #457 from codecrafters-io/TropicolX-patch-82
Revise "Respond to ACL WHOAMI #jn4"
2 parents 74ddac4 + 4cb0cc9 commit 0802d0b

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

stage_descriptions/auth-01-jn4.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
In this stage, you'll add support for responding to the `ACL WHOAMI` command.
22

3-
### The `ACL WHOAMI` command
3+
### The `ACL WHOAMI` Command
44

5-
The [`ACL WHOAMI`](https://redis.io/docs/latest/commands/acl-whoami/) command is used to return the username the current connection is authenticated with.
5+
The [`ACL WHOAMI`](https://redis.io/docs/latest/commands/acl-whoami/) command returns the username associated with the current connection.
66

7-
In Redis, every new connection is automatically authenticated using the `default` user. This feature can be turned off, making every new connection unauthenticated at first. We'll get to that in the later stages.
8-
9-
Example usage:
7+
By default, every new connection in Redis is automatically authenticated as the `default` user. For example:
108

119
```bash
1210
> ACL WHOAMI
1311
"default"
1412
```
1513

16-
It returns the username of currently authenticated user, encoded as a [RESP bulk string](https://redis.io/docs/latest/develop/reference/protocol-spec/#bulk-strings).
14+
The command returns the username of the currently authenticated user, encoded as a [RESP bulk string](https://redis.io/docs/latest/develop/reference/protocol-spec/#bulk-strings).
15+
16+
This default authentication behavior can be changed so that new connections start out unauthenticated. We'll cover that in later stages.
1717

1818
### Tests
1919

@@ -23,22 +23,16 @@ The tester will execute your program like this:
2323
$ ./your_program.sh
2424
```
2525

26-
It'll then send an `ACL WHOAMI` command.
26+
It will then send an `ACL WHOAMI` command:
2727

2828
```bash
2929
# Expect RESP bulk string: "default"
30-
$ redis-cli
31-
> ACL WHOAMI
30+
$ redis-cli ACL WHOAMI
3231
"default"
3332
```
3433

35-
The tester will validate that the response is the string `default`, which is RESP encoded as:
36-
37-
```
38-
$7\r\n
39-
default\r\n
40-
```
34+
The tester will expect to receive `$7\r\ndefault\r\n` as a response. That's the string `default` encoded as a [bulk string](https://redis.io/docs/latest/develop/reference/protocol-spec/#bulk-strings).
4135

4236
### Notes
4337

44-
- In this stage, you can hardcode the response of the `ACL WHOAMI` command to be `default`. We'll get to enforcing authentication in the later stages.
38+
- In this stage, you can hardcode the response of the `ACL WHOAMI` command to be `default`. We'll get to enforcing authentication in the later stages.

0 commit comments

Comments
 (0)