From 516e4ff35766f58fdc923a3f99a9a74d7b87940f Mon Sep 17 00:00:00 2001 From: Oluwabusayo Jacobs <68024640+TropicolX@users.noreply.github.com> Date: Fri, 7 Nov 2025 08:11:21 +0100 Subject: [PATCH 1/2] Revise "Respond to ACL WHOAMI #jn4" Updated formatting and clarified examples in the ACL WHOAMI command section. --- stage_descriptions/auth-01-jn4.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/stage_descriptions/auth-01-jn4.md b/stage_descriptions/auth-01-jn4.md index 98e99fb4..f4755cf5 100644 --- a/stage_descriptions/auth-01-jn4.md +++ b/stage_descriptions/auth-01-jn4.md @@ -1,19 +1,19 @@ In this stage, you'll add support for responding to the `ACL WHOAMI` command. -### The `ACL WHOAMI` command +### The `ACL WHOAMI` Command The [`ACL WHOAMI`](https://redis.io/docs/latest/commands/acl-whoami/) command is used to return the username the current connection is authenticated with. 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. -Example usage: +For example ```bash > ACL WHOAMI "default" ``` -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). +It 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). ### Tests @@ -23,7 +23,7 @@ The tester will execute your program like this: $ ./your_program.sh ``` -It'll then send an `ACL WHOAMI` command. +It will then send an `ACL WHOAMI` command. ```bash # Expect RESP bulk string: "default" @@ -32,13 +32,18 @@ $ redis-cli "default" ``` -The tester will validate that the response is the string `default`, which is RESP encoded as: +Your server should respond with the bulk string `default`: ``` $7\r\n default\r\n ``` +The tester will verify that: +- Your server responds to the `ACL WHOAMI` command +- The response is the string `"default"` encoded as a RESP bulk string +- The RESP encoding is correct (length prefix `$7\r\n` followed by `default\r\n`) + ### Notes -- 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. \ No newline at end of file +- 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. From 4cb0cc95b68dcfc6940586e013c06b6d98169e2d Mon Sep 17 00:00:00 2001 From: Oluwabusayo Jacobs <68024640+TropicolX@users.noreply.github.com> Date: Fri, 7 Nov 2025 21:28:37 +0100 Subject: [PATCH 2/2] Clarify ACL WHOAMI command details Updated the explanation of the ACL WHOAMI command, clarifying default authentication behavior and response expectations. --- stage_descriptions/auth-01-jn4.md | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/stage_descriptions/auth-01-jn4.md b/stage_descriptions/auth-01-jn4.md index f4755cf5..00f07530 100644 --- a/stage_descriptions/auth-01-jn4.md +++ b/stage_descriptions/auth-01-jn4.md @@ -2,18 +2,18 @@ In this stage, you'll add support for responding to the `ACL WHOAMI` command. ### The `ACL WHOAMI` Command -The [`ACL WHOAMI`](https://redis.io/docs/latest/commands/acl-whoami/) command is used to return the username the current connection is authenticated with. +The [`ACL WHOAMI`](https://redis.io/docs/latest/commands/acl-whoami/) command returns the username associated with the current connection. -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. - -For example +By default, every new connection in Redis is automatically authenticated as the `default` user. For example: ```bash > ACL WHOAMI "default" ``` -It 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). +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). + +This default authentication behavior can be changed so that new connections start out unauthenticated. We'll cover that in later stages. ### Tests @@ -23,26 +23,15 @@ The tester will execute your program like this: $ ./your_program.sh ``` -It will then send an `ACL WHOAMI` command. +It will then send an `ACL WHOAMI` command: ```bash # Expect RESP bulk string: "default" -$ redis-cli -> ACL WHOAMI +$ redis-cli ACL WHOAMI "default" ``` -Your server should respond with the bulk string `default`: - -``` -$7\r\n -default\r\n -``` - -The tester will verify that: -- Your server responds to the `ACL WHOAMI` command -- The response is the string `"default"` encoded as a RESP bulk string -- The RESP encoding is correct (length prefix `$7\r\n` followed by `default\r\n`) +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). ### Notes