From 2b7b2130cac9458a67b5c10379fec0a31f90316a Mon Sep 17 00:00:00 2001 From: Nathan Harris Date: Wed, 27 Mar 2019 23:07:01 -0700 Subject: [PATCH] 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 --- Sources/NIORedis/Commands/BasicCommands.swift | 11 ----------- Sources/NIORedis/RedisClient.swift | 3 ++- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Sources/NIORedis/Commands/BasicCommands.swift b/Sources/NIORedis/Commands/BasicCommands.swift index 156d544..0cd0a76 100644 --- a/Sources/NIORedis/Commands/BasicCommands.swift +++ b/Sources/NIORedis/Commands/BasicCommands.swift @@ -25,17 +25,6 @@ extension RedisClient { .mapFromRESP() } - /// Request for authentication in a password-protected Redis server. - /// - /// [https://redis.io/commands/auth](https://redis.io/commands/auth) - /// - Parameter password: The password being used to access the Redis server. - /// - Returns: An `EventLoopFuture` that resolves when the connection has been authorized, or fails with a `RedisError`. - @inlinable - public func authorize(with password: String) -> EventLoopFuture { - return send(command: "AUTH", with: [password]) - .map { _ in return () } - } - /// Select the Redis logical database having the specified zero-based numeric index. /// - Note: New connections always use the database `0`. /// diff --git a/Sources/NIORedis/RedisClient.swift b/Sources/NIORedis/RedisClient.swift index 02f64c7..9bff4e2 100644 --- a/Sources/NIORedis/RedisClient.swift +++ b/Sources/NIORedis/RedisClient.swift @@ -161,7 +161,8 @@ extension RedisConnection { guard let pw = password else { return eventLoopGroup.next().makeSucceededFuture(client) } - return client.authorize(with: pw) + + return client.send(command: "AUTH", with: [pw]) .map { _ in return client } } }