line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::SslAuth; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2194
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
5
|
1
|
|
|
1
|
|
14
|
use Mojo::IOLoop; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.08'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
43
|
use base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
201
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub register { |
12
|
1
|
|
|
1
|
1
|
31
|
my ($plugin, $app) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$app->helper( |
15
|
|
|
|
|
|
|
ssl_auth => sub { |
16
|
2
|
|
|
2
|
|
92585
|
my $self = shift; |
17
|
2
|
|
|
|
|
4
|
my $callback = shift; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
31
|
my $id = $self->tx->connection; |
20
|
2
|
|
|
|
|
28
|
my $handle = Mojo::IOLoop->stream($id)->handle; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Not SSL connection |
23
|
2
|
50
|
|
|
|
38
|
return if ref $handle ne 'IO::Socket::SSL'; |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
6
|
return $callback->($handle); |
26
|
|
|
|
|
|
|
} |
27
|
1
|
|
|
|
|
10
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
__END__ |