Skip to content

Commit 2b7b213

Browse files
committed
Remove authorize convenience command method
Motivation: As this command is embedded in the creation of a `RedisConnection` and you authorize an entire connection to a Redis instance - this command serves no purpose and could make it easier for users to shoot themselves in the foot. Results: `authorize(with:)` convenience method is removed, and the `RedisConnection.connect` method now sends a raw command
1 parent 152eb30 commit 2b7b213

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

Sources/NIORedis/Commands/BasicCommands.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,6 @@ extension RedisClient {
2525
.mapFromRESP()
2626
}
2727

28-
/// Request for authentication in a password-protected Redis server.
29-
///
30-
/// [https://redis.io/commands/auth](https://redis.io/commands/auth)
31-
/// - Parameter password: The password being used to access the Redis server.
32-
/// - Returns: An `EventLoopFuture` that resolves when the connection has been authorized, or fails with a `RedisError`.
33-
@inlinable
34-
public func authorize(with password: String) -> EventLoopFuture<Void> {
35-
return send(command: "AUTH", with: [password])
36-
.map { _ in return () }
37-
}
38-
3928
/// Select the Redis logical database having the specified zero-based numeric index.
4029
/// - Note: New connections always use the database `0`.
4130
///

Sources/NIORedis/RedisClient.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ extension RedisConnection {
161161
guard let pw = password else {
162162
return eventLoopGroup.next().makeSucceededFuture(client)
163163
}
164-
return client.authorize(with: pw)
164+
165+
return client.send(command: "AUTH", with: [pw])
165166
.map { _ in return client }
166167
}
167168
}

0 commit comments

Comments
 (0)