File: AuthPasswdHash.pm

package info (click to toggle)
libevent-rpc-perl 1.08-2%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 520 kB
  • sloc: perl: 2,353; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 497 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package Event::RPC::AuthPasswdHash;

use strict;
use Carp;

sub get_passwd_href             { shift->{passwd_href}                  }
sub set_passwd_href             { shift->{passwd_href}          = $_[1] }

sub new {
    my $class = shift;
    my ($passwd_href) = @_;

    my $self = bless {
        passwd_href => $passwd_href,
    };
    
    return $self;
}

sub check_credentials {
    my $self = shift;
    my ($user, $pass) = @_;
    return $pass eq $self->get_passwd_href->{$user};
}

1;