| 1 | package DJabberd::Authen::InMemoryOnly; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use base 'DJabberd::Authen'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 7 | 1 | my $class = shift; | |||||||||
| 8 | 1 | my $self = $class->SUPER::new; | |||||||||
| 9 | 1 | $self->{_users} = {}; # username -> $password | |||||||||
| 10 | 1 | return $self; | |||||||||
| 11 | } | ||||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | sub can_register_jids { 1 } | ||||||||
|
Subroutine
can_register_jids: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 14 | 1 | ▶ | sub can_unregister_jids { 1 } | ||||||||
|
Subroutine
can_unregister_jids: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 15 | 1 | ▶ | sub can_retrieve_cleartext { 1 } | ||||||||
|
Subroutine
can_retrieve_cleartext: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 16 | |||||||||||
| 17 | 0 | ▶ | sub unregister_jid { | ||||||||
|
Subroutine
unregister_jid: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 18 | 0 | my ($self, $cb, %args) = @_; | |||||||||
| 19 | 0 | my $user = $args{'username'}; | |||||||||
| 20 | 0 | ▶ | if (delete $self->{_users}{$user}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 0 | $cb->deleted; | |||||||||
| 22 | } else { | ||||||||||
| 23 | 0 | $cb->notfound; | |||||||||
| 24 | } | ||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub register_jid { | ||||||||
|
Subroutine
register_jid: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 28 | 0 | my ($self, $cb, %args) = @_; | |||||||||
| 29 | 0 | my $user = $args{'username'}; | |||||||||
| 30 | 0 | my $pass = $args{'password'}; | |||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | if (defined $self->{_users}{$user}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | $cb->conflict; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 0 | $self->{_users}{$user} = $pass; | |||||||||
| 37 | 0 | $cb->saved; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub check_cleartext { | ||||||||
|
Subroutine
check_cleartext: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 41 | 0 | my ($self, $cb, %args) = @_; | |||||||||
| 42 | 0 | my $user = $args{'username'}; | |||||||||
| 43 | |||||||||||
| 44 | 0 | my $pass = $args{'password'}; | |||||||||
| 45 | 0 | ▶ | unless (defined $self->{_users}{$user}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 0 | return $cb->reject; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 0 | my $goodpass = $self->{_users}{$user}; | |||||||||
| 50 | 0 | ▶ | unless ($pass eq $goodpass) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 0 | return $cb->reject; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 0 | $cb->decline; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 0 | ▶ | sub get_password { | ||||||||
|
Subroutine
get_password: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 58 | 0 | my ($self, $cb, %args) = @_; | |||||||||
| 59 | 0 | my $user = $args{'username'}; | |||||||||
| 60 | 0 | ▶ | if (my $pass = $self->{_users}{$user}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | $cb->set($pass); | |||||||||
| 62 | 0 | return; | |||||||||
| 63 | } | ||||||||||
| 64 | 0 | $cb->decline; | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | 1 | 1; | |||||||||