line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Auth::SSO::ResponseParser::CAS; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
86748
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
519
|
use utf8; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
10
|
|
5
|
2
|
|
|
2
|
|
466
|
use Data::Util qw(:check); |
|
2
|
|
|
|
|
614
|
|
|
2
|
|
|
|
|
336
|
|
6
|
2
|
|
|
2
|
|
463
|
use Moo; |
|
2
|
|
|
|
|
9641
|
|
|
2
|
|
|
|
|
12
|
|
7
|
2
|
|
|
2
|
|
2215
|
use XML::LibXML; |
|
2
|
|
|
|
|
48678
|
|
|
2
|
|
|
|
|
14
|
|
8
|
2
|
|
|
2
|
|
304
|
use XML::LibXML::XPathContext; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
514
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = "0.0137"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with "Plack::Auth::SSO::ResponseParser"; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub parse { |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
0
|
1852
|
my ( $self, $obj ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
|
|
5
|
my $xpath; |
19
|
|
|
|
|
|
|
|
20
|
3
|
50
|
|
|
|
19
|
if ( is_instance( $obj, "XML::LibXML" ) ) { |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
$xpath = XML::LibXML::XPathContext->new( $obj ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
|
|
22
|
$xpath = XML::LibXML::XPathContext->new( |
28
|
|
|
|
|
|
|
XML::LibXML->load_xml( string => $obj ) |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
1020
|
$xpath->registerNs( "cas", "http://www.yale.edu/tp/cas" ); |
34
|
3
|
|
|
|
|
10
|
$self->from_doc( $xpath ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub from_doc { |
39
|
|
|
|
|
|
|
|
40
|
3
|
|
|
3
|
0
|
15
|
my ( $self, $xpath ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
14
|
my %attributes; |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
27
|
for my $attr ( $xpath->find( "/cas:serviceResponse/cas:authenticationSuccess/cas:attributes/child::*" )->get_nodelist() ) { |
45
|
|
|
|
|
|
|
|
46
|
18
|
|
|
|
|
290
|
my $key = $attr->localname(); |
47
|
18
|
|
|
|
|
54
|
my $value = $attr->textContent(); |
48
|
|
|
|
|
|
|
|
49
|
18
|
100
|
|
|
|
38
|
if ( exists( $attributes{$key} ) ) { |
50
|
|
|
|
|
|
|
|
51
|
3
|
50
|
|
|
|
13
|
if ( is_string( $attributes{$key} ) ) { |
|
|
0
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
3
|
|
|
|
|
12
|
$attributes{$key} = [ $attributes{$key}, $value ]; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
elsif ( is_array_ref( $attributes{$key} ) ) { |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
0
|
$attributes{$key} = [ @{ $attributes{$key} }, $value ]; |
|
0
|
|
|
|
|
0
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else { |
64
|
|
|
|
|
|
|
|
65
|
15
|
|
|
|
|
36
|
$attributes{$key} = $value; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
+{ |
72
|
3
|
|
|
|
|
14
|
extra => {}, |
73
|
|
|
|
|
|
|
info => \%attributes, |
74
|
|
|
|
|
|
|
uid => $xpath->findvalue( "/cas:serviceResponse/cas:authenticationSuccess/cas:user" ) |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|