scala-redis-nb icon indicating copy to clipboard operation
scala-redis-nb copied to clipboard

Using passwordAuthentication for url based authentication

Open aktasonur opened this issue 10 years ago • 12 comments

Authenticator.setDefault(new Auth(username, password)) is not working for secured url access. (i.e. RedisToGo hosted service url is something like redis://username:[email protected]:port)

Is there any workaround for this?

aktasonur avatar Oct 13 '13 20:10 aktasonur

Let me have a look at it over the weekend. Thanks for reporting.

debasishg avatar Oct 16 '13 05:10 debasishg

Any update on this?

JakeHP avatar Apr 15 '14 18:04 JakeHP

Unfortunately not yet done .. will take a shot at the earliest.

debasishg avatar Apr 16 '14 05:04 debasishg

Is there a solution for setting the password in the RedisClient? I'm using 0.7 and don't see any password variable there

byrnedo avatar May 21 '15 19:05 byrnedo

Unfortunately it fell through the cracks :-( .. I will try to take a look over the weekend.

debasishg avatar May 21 '15 19:05 debasishg

Thanks, much appreciated!

byrnedo avatar May 21 '15 19:05 byrnedo

Just see that I could just use the auth command. Maybe that suffices?

byrnedo avatar May 21 '15 20:05 byrnedo

auth command is usable, as it's one of the APIs supported now (https://github.com/debasishg/scala-redis-nb/blob/master/src/main/scala/com/redis/api/ConnectionOperations.scala#L26) .. Let me know if this works for you. Or you are looking for something else ..

debasishg avatar May 21 '15 21:05 debasishg

After looking at what would be involved, it would be nice if the RedisClient could accept the secret/password and send the auth command on connect. Would it be a lot to implement this?

byrnedo avatar May 23 '15 07:05 byrnedo

The problem is to run any command from within RedisClient I need to get hold of an ActorSystem, ExecutionContext and things like that.

debasishg avatar May 23 '15 14:05 debasishg

If I were to use the auth command in my own code, have you any suggestions about best practice? Does the auth 'session' time out? If so then wouldn't I need to catch some kind of exception and retry the auth command while buffering the mongo requests in the mean time?

byrnedo avatar Jun 12 '15 09:06 byrnedo

Use auth just like any other command. The timeout is handled by an entry in redis.conf named timeout - setting it to 0 will disable the timeout between the client and the server.

debasishg avatar Jun 15 '15 06:06 debasishg