| 1 | package DJabberd::Authen; | ||||||||||
| 2 | 20 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 20 | ▶ | use base 'DJabberd::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 83 | ▶ | sub register { | ||||||||
|
Subroutine
register: called CC=5 SCAR=19.9
Pod
undocumented
| |||||||||||
| 6 | 83 | my ($self, $vhost) = @_; | |||||||||
| 7 | |||||||||||
| 8 | # my $which; | ||||||||||
| 9 | # if (($which = $self->can('foo')) && $which != &base_class_one) { | ||||||||||
| 10 | # } | ||||||||||
| 11 | |||||||||||
| 12 | 83 | ▶ | if ($self->can_retrieve_cleartext) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | 0 | ▶ | $vhost->register_hook("GetPassword", sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 14 | 0 | my (undef, $cb, %args) = @_; | |||||||||
| 15 | # args as 'username' and 'conn'; | ||||||||||
| 16 | # cb can ->set or ->decline | ||||||||||
| 17 | 0 | $self->get_password($cb, %args); | |||||||||
| 18 | 42 | }); | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 83 | ▶ | if ($self->can_check_digest) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | ▶ | $vhost->register_hook("CheckDigest", sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 23 | 0 | my (undef, $cb, %args) = @_; | |||||||||
| 24 | # args as 'username', 'conn', 'digest' | ||||||||||
| 25 | # cb can ->accept or ->reject | ||||||||||
| 26 | 0 | $self->check_digest($cb, %args); | |||||||||
| 27 | 0 | }); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | $vhost->register_hook("CheckCleartext", sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 31 | 0 | my (undef, $cb, %args) = @_; | |||||||||
| 32 | # args containing: username, conn, password | ||||||||||
| 33 | 0 | $self->check_cleartext($cb, %args); | |||||||||
| 34 | 83 | }); | |||||||||
| 35 | |||||||||||
| 36 | 0 | ▶ | $vhost->register_hook("CheckJID", sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 37 | 0 | my (undef, $cb, %args) = @_; | |||||||||
| 38 | # args contain: username and conn | ||||||||||
| 39 | 0 | $self->check_jid($cb, %args); | |||||||||
| 40 | |||||||||||
| 41 | 83 | }); | |||||||||
| 42 | |||||||||||
| 43 | 83 | ▶ | if ($self->can_register_jids) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | ▶ | $vhost->register_hook("RegisterJID", sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 45 | 0 | my (undef, $cb, %args) = @_; | |||||||||
| 46 | # args containing: username, password | ||||||||||
| 47 | # cb can: | ||||||||||
| 48 | # conflict | ||||||||||
| 49 | # error | ||||||||||
| 50 | # saved | ||||||||||
| 51 | 0 | $self->register_jid($cb, %args); | |||||||||
| 52 | 1 | }); | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 83 | ▶ | if ($self->can_unregister_jids) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 0 | ▶ | $vhost->register_hook("UnregisterJID", sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 57 | 0 | my (undef, $cb, %args) = @_; | |||||||||
| 58 | # args containing: username | ||||||||||
| 59 | # cb can: | ||||||||||
| 60 | # conflict | ||||||||||
| 61 | # error | ||||||||||
| 62 | # saved | ||||||||||
| 63 | 0 | $self->unregister_jid($cb, %args); | |||||||||
| 64 | 1 | }); | |||||||||
| 65 | } | ||||||||||
| 66 | |||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 82 | ▶ | sub can_register_jids { | ||||||||
|
Subroutine
can_register_jids: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 70 | 82 | 0; | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 82 | ▶ | sub can_unregister_jids { | ||||||||
|
Subroutine
can_unregister_jids: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 74 | 82 | 0; | |||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | 41 | ▶ | sub can_retrieve_cleartext { | ||||||||
|
Subroutine
can_retrieve_cleartext: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 78 | 41 | 0; | |||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | 83 | ▶ | sub can_check_digest { | ||||||||
|
Subroutine
can_check_digest: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 82 | 83 | 0; | |||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | 0 | ▶ | sub check_jid { | ||||||||
|
Subroutine
check_jid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 86 | 0 | my ($self, $cb, %args) = @_; | |||||||||
| 87 | 0 | return 0; | |||||||||
| 88 | } | ||||||||||
| 89 | |||||||||||
| 90 | 0 | ▶ | sub unregister_jid { | ||||||||
|
Subroutine
unregister_jid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 91 | 0 | my ($self, $cb, %args) = @_; | |||||||||
| 92 | 0 | return 0; | |||||||||
| 93 | } | ||||||||||
| 94 | |||||||||||
| 95 | 0 | ▶ | sub check_cleartext { | ||||||||
|
Subroutine
check_cleartext: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 96 | 0 | my ($self, $cb, %args) = @_; | |||||||||
| 97 | 0 | $cb->reject; | |||||||||
| 98 | } | ||||||||||
| 99 | |||||||||||
| 100 | 0 | ▶ | sub check_digest { | ||||||||
|
Subroutine
check_digest: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 101 | 0 | my ($self, $cb, %args) = @_; | |||||||||
| 102 | 0 | $cb->reject; | |||||||||
| 103 | } | ||||||||||
| 104 | |||||||||||
| 105 | |||||||||||
| 106 | 20 | 1; | |||||||||