Better authentication support #17

Closed
sparkertime opened this Issue Sep 28, 2012 · 0 comments

Comments

Projects
None yet
2 participants

Unless I'm missing something obvious, using a password with your redis connection is a bit of a pain right now.

In order to auth, you need to structure your redis queries as so:

(redis/with-connection conn
                       (redis/auth "password")
                       ;your actual redis commands go here
                       (redis/get "asdasd"))

However, because of pipelining, you'll get back the response from auth (generally "OK") along with your result set.

I've written a macro to deal with this in my project that inserts the auth call and filters out the auth response from the result, but I wonder if this doesn't make more sense in the library. Seems like since connection-map can take a :password argument, you were at least considering this.

I'm happy to submit a patch, but would like some direction as there's a variety of ways to skin this cat:

  1. When connection-map contains the password, automatically invoke the auth request as part of with-connection. (This would probably necessitate removing auth from defqueries, as I can't see a reason to manually invoke auth any longer)
  2. Tweak pipelining in some way to exclude calls to auth from appending to the pipeline result (since you mention that the behavior is subject to change in the README)
  3. Leave it as-is (but then I'd recommend removing :password from the connection-map, as its presence implies it does something)
  4. Create a separate "with-auth" entry point that basically does the same as my macro described above.

@abedra abedra closed this Oct 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment