Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit username/password support #11

Closed
melo opened this issue Mar 6, 2012 · 6 comments
Closed

Explicit username/password support #11

melo opened this issue Mar 6, 2012 · 6 comments
Labels
Milestone

Comments

@melo
Copy link
Member

melo commented Mar 6, 2012

Moved from RT: https://rt.cpan.org/Ticket/Display.html?id=75562

On Mon Mar 05 19:34:12 2012, ETHER wrote:

It doesn't look like the constructor accepts username/password options,
which is the usual place where a client would specify its credentials.

True, it should.

I see that authentication can be done by sending the AUTH command
(http://redis.io/commands/auth), which should be available via
$redis->auth and the magic of AUTOLOAD, but this is not instantly
obvious to all users of the client, so it would be nice if the
constructor handled this.

Agreed.

I'd be happy to patch in this support, if I could only figure out where
you keep the source... it doesn't seem to be on github, and there is no
relevant meta information in your META.yml.

It is on Github. And thanks for pointing out that the information is not in the documentation. Time to convert that dist to Dist::Zilla to avoid this oversights.

http://github.com/melo/perl-redis/

(I also see some documentation errors, which I'd also be happy to supply
a patch for.)

Feel free to send pull requests, I'm planning on working on Redis the next weekend, to make a release next week. At least the auth information in the constructor would be nice to have.

Bye

melo added a commit that referenced this issue Mar 12, 2012
If a password attr is given to new, Redis.pm will automatically send the
AUTH command after every connection.

First part of #11, but behaviour with auto-reconnect and tests still not
finished.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
@melo
Copy link
Member Author

melo commented Mar 12, 2012

I didn't include this into the 1.950 release. I still want to think a bit what to do when the password fails and we have auto-reconnect on.

Should we just keep trying? or just really really die?

Also I want to add proper tests, but I want to fix #13 before doing so.

Right now the code is in the auto_auth branch if you want to experiment. Just pass password => 'something' to the new() constructor.

@melo
Copy link
Member Author

melo commented Jun 1, 2012

I responded to an email question about this just now. In my reply I suggested using this as a temporary solution. Please note, I did not test this but "it should work"™ :)

package My::Redis;

use strict;
use base 'Redis';

sub __connect {
  my $self = shift;

  $self->SUPER::__connect(@_);
  $self->auth('your_password');

  return;
}

1;

@arbeca
Copy link

arbeca commented Jun 5, 2012

Hello,
Do you have any idea when you will release this feature (password in new method) ?
Thanks

@melo
Copy link
Member Author

melo commented Jun 5, 2012

End of this week... I hope to have some free time friday to do a new release, I have several small fixes piled up.

@arbeca
Copy link

arbeca commented Jun 5, 2012

Great, many thanks :)

melo added a commit that referenced this issue Jun 9, 2012
If a password attr is given to new, Redis.pm will automatically send the
AUTH command after every connection.

First part of #11, but behaviour with auto-reconnect and tests still not
finished.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
melo added a commit that referenced this issue Jun 9, 2012
If you create your Redis instance with a bad password, it will die with a
stacktrace. We also disable reconnect to prevent loops.

(updates #11)

Signed-off-by: Pedro Melo <melo@simplicidade.org>
@melo
Copy link
Member Author

melo commented Sep 4, 2012

Fixed with 1.952, on the way to CPAN.

@melo melo closed this as completed Sep 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants