line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ark::Plugin::Authentication::Backend; |
2
|
3
|
|
|
3
|
|
1964
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
108
|
|
3
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
95
|
|
4
|
3
|
|
|
3
|
|
16
|
use Ark 'Component'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
18
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has user => ( |
7
|
|
|
|
|
|
|
is => 'rw', |
8
|
|
|
|
|
|
|
isa => 'Maybe[Ark::Plugin::Authentication::User]', |
9
|
|
|
|
|
|
|
lazy => 1, |
10
|
|
|
|
|
|
|
builder => 'restore_user', |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has realms => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
isa => 'HashRef', |
16
|
|
|
|
|
|
|
lazy => 1, |
17
|
|
|
|
|
|
|
default => sub { |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $conf = $self->app->config->{'Plugin::Authentication'} |
21
|
|
|
|
|
|
|
}, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub persist_user { |
25
|
3
|
|
|
3
|
0
|
6
|
my ($self, $user) = @_; |
26
|
3
|
|
|
|
|
14
|
$self->context->session->regenerate; |
27
|
3
|
|
|
|
|
613
|
$self->context->session->set( __user => $user->for_session ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub restore_user { |
31
|
7
|
|
|
7
|
0
|
514
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
7
|
100
|
|
|
|
46
|
my $user = $self->context->session->get('__user') or return; |
34
|
|
|
|
|
|
|
|
35
|
3
|
50
|
|
|
|
1285
|
return unless ref $user eq 'HASH'; |
36
|
3
|
50
|
33
|
|
|
32
|
return unless $user->{hash} && $user->{store}; |
37
|
|
|
|
|
|
|
|
38
|
3
|
|
|
|
|
17
|
$self->from_session($user); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub logout { |
42
|
1
|
|
|
1
|
0
|
16
|
my $self = shift; |
43
|
1
|
|
|
|
|
4
|
$self->context->session->remove( '__user' ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Credential |
47
|
3
|
|
|
3
|
0
|
12
|
sub authenticate { } |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Store |
50
|
3
|
|
|
3
|
0
|
8
|
sub find_user { } |
51
|
3
|
|
|
3
|
0
|
10
|
sub from_session { } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |