line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SAML2::Protocol::LogoutRequest; |
2
|
25
|
|
|
25
|
|
186
|
use Moose; |
|
25
|
|
|
|
|
53
|
|
|
25
|
|
|
|
|
205
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.72'; # TRIAL VERSION |
4
|
25
|
|
|
25
|
|
160132
|
use MooseX::Types::Common::String qw/ NonEmptySimpleStr /; |
|
25
|
|
|
|
|
51
|
|
|
25
|
|
|
|
|
303
|
|
5
|
25
|
|
|
25
|
|
69071
|
use MooseX::Types::URI qw/ Uri /; |
|
25
|
|
|
|
|
61
|
|
|
25
|
|
|
|
|
202
|
|
6
|
25
|
|
|
25
|
|
40653
|
use Net::SAML2::XML::Util qw/ no_comments /; |
|
25
|
|
|
|
|
62
|
|
|
25
|
|
|
|
|
1599
|
|
7
|
25
|
|
|
25
|
|
175
|
use XML::Generator; |
|
25
|
|
|
|
|
57
|
|
|
25
|
|
|
|
|
299
|
|
8
|
25
|
|
|
25
|
|
1292
|
use URN::OASIS::SAML2 qw(:urn); |
|
25
|
|
|
|
|
62
|
|
|
25
|
|
|
|
|
17936
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Net::SAML2::Role::ProtocolMessage'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: SAML2 LogoutRequest Protocol object |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'session' => (isa => NonEmptySimpleStr, is => 'ro', required => 1); |
16
|
|
|
|
|
|
|
has 'nameid' => (isa => NonEmptySimpleStr, is => 'ro', required => 1); |
17
|
|
|
|
|
|
|
has 'nameid_format' => ( |
18
|
|
|
|
|
|
|
isa => NonEmptySimpleStr, |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
required => 0, |
21
|
|
|
|
|
|
|
predicate => 'has_nameid_format' |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
has 'destination' => ( |
24
|
|
|
|
|
|
|
isa => NonEmptySimpleStr, |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
required => 0, |
27
|
|
|
|
|
|
|
predicate => 'has_destination' |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has sp_provided_id => ( |
31
|
|
|
|
|
|
|
isa => NonEmptySimpleStr, |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
required => 0, |
34
|
|
|
|
|
|
|
predicate => 'has_sp_provided_id' |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has affiliation_group_id => ( |
38
|
|
|
|
|
|
|
isa => NonEmptySimpleStr, |
39
|
|
|
|
|
|
|
is => 'ro', |
40
|
|
|
|
|
|
|
required => 0, |
41
|
|
|
|
|
|
|
predicate => 'has_affiliation_group_id' |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has name_qualifier => ( |
45
|
|
|
|
|
|
|
isa => NonEmptySimpleStr, |
46
|
|
|
|
|
|
|
is => 'ro', |
47
|
|
|
|
|
|
|
required => 0, |
48
|
|
|
|
|
|
|
predicate => 'has_name_qualifier' |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
has include_name_qualifier => |
51
|
|
|
|
|
|
|
(isa => 'Bool', is => 'ro', required => 0, default => 0); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
around BUILDARGS => sub { |
54
|
|
|
|
|
|
|
my $orig = shift; |
55
|
|
|
|
|
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
my %args = @_; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
if ($args{nameid_format} && $args{nameid_format} eq 'urn:oasis:names:tc:SAML:2.0:nameidformat:persistent') { |
59
|
|
|
|
|
|
|
$args{include_name_qualifier} = 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
return $self->$orig(%args); |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub new_from_xml { |
68
|
1
|
|
|
1
|
1
|
1167
|
my ($class, %args) = @_; |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
5
|
my $dom = no_comments($args{xml}); |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
12
|
my $xpath = XML::LibXML::XPathContext->new($dom); |
73
|
1
|
|
|
|
|
5
|
$xpath->registerNs('saml', URN_ASSERTION); |
74
|
1
|
|
|
|
|
5
|
$xpath->registerNs('samlp', URN_PROTOCOL); |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
4
|
my %params = ( |
77
|
|
|
|
|
|
|
id => $xpath->findvalue('/samlp:LogoutRequest/@ID'), |
78
|
|
|
|
|
|
|
session => $xpath->findvalue('/samlp:LogoutRequest/samlp:SessionIndex'), |
79
|
|
|
|
|
|
|
issuer => $xpath->findvalue('/samlp:LogoutRequest/saml:Issuer'), |
80
|
|
|
|
|
|
|
nameid => $xpath->findvalue('/samlp:LogoutRequest/saml:NameID'), |
81
|
|
|
|
|
|
|
destination => $xpath->findvalue('/samlp:LogoutRequest/@Destination'), |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
|
84
|
1
|
|
|
|
|
236
|
my $nameid_format |
85
|
|
|
|
|
|
|
= $xpath->findvalue('/samlp:LogoutRequest/saml:NameID/@Format'); |
86
|
|
|
|
|
|
|
|
87
|
1
|
50
|
|
|
|
82
|
$params{nameid_format} = $nameid_format |
88
|
|
|
|
|
|
|
if NonEmptySimpleStr->check($nameid_format); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$params{include_name_qualifier} = $args{include_name_qualifier} |
91
|
1
|
50
|
|
|
|
805
|
if $args{include_name_qualifier}; |
92
|
|
|
|
|
|
|
|
93
|
1
|
|
|
|
|
30
|
return $class->new(%params); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub as_xml { |
98
|
6
|
|
|
6
|
1
|
1138
|
my $self = shift; |
99
|
|
|
|
|
|
|
|
100
|
6
|
|
|
|
|
38
|
my $x = XML::Generator->new(':pretty=0'); |
101
|
6
|
|
|
|
|
658
|
my $saml = ['saml' => URN_ASSERTION]; |
102
|
6
|
|
|
|
|
17
|
my $samlp = ['samlp' => URN_PROTOCOL]; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
6
|
50
|
|
|
|
211
|
$x->xml( |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
106
|
|
|
|
|
|
|
$x->LogoutRequest( |
107
|
|
|
|
|
|
|
$samlp, |
108
|
|
|
|
|
|
|
{ |
109
|
|
|
|
|
|
|
ID => $self->id, |
110
|
|
|
|
|
|
|
IssueInstant => $self->issue_instant, |
111
|
|
|
|
|
|
|
$self->has_destination |
112
|
|
|
|
|
|
|
? (Destination => $self->destination) |
113
|
|
|
|
|
|
|
: (), |
114
|
|
|
|
|
|
|
Version => '2.0' |
115
|
|
|
|
|
|
|
}, |
116
|
|
|
|
|
|
|
$x->Issuer($saml, $self->issuer), |
117
|
|
|
|
|
|
|
$x->NameID( |
118
|
|
|
|
|
|
|
$saml, |
119
|
|
|
|
|
|
|
{ |
120
|
|
|
|
|
|
|
$self->has_nameid_format |
121
|
|
|
|
|
|
|
? (Format => $self->nameid_format) |
122
|
|
|
|
|
|
|
: (), |
123
|
|
|
|
|
|
|
$self->has_sp_provided_id ? ( |
124
|
|
|
|
|
|
|
SPProvidedID => $self->sp_provided_id |
125
|
|
|
|
|
|
|
) : (), |
126
|
|
|
|
|
|
|
$self->include_name_qualifier |
127
|
|
|
|
|
|
|
? ( |
128
|
|
|
|
|
|
|
$self->has_name_qualifier |
129
|
|
|
|
|
|
|
? (NameQualifier => $self->name_qualifier) |
130
|
|
|
|
|
|
|
: ($self->has_destination ? (NameQualifier => $self->destination) : ()), |
131
|
|
|
|
|
|
|
SPNameQualifier => |
132
|
|
|
|
|
|
|
$self->has_affiliation_group_id ? $self->affiliation_group_id : $self->issuer |
133
|
|
|
|
|
|
|
) |
134
|
|
|
|
|
|
|
: (), |
135
|
|
|
|
|
|
|
}, |
136
|
|
|
|
|
|
|
$self->nameid |
137
|
|
|
|
|
|
|
), |
138
|
|
|
|
|
|
|
$x->SessionIndex($samlp, $self->session), |
139
|
|
|
|
|
|
|
) |
140
|
|
|
|
|
|
|
); |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
__END__ |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=pod |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=encoding UTF-8 |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 NAME |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Net::SAML2::Protocol::LogoutRequest - SAML2 LogoutRequest Protocol object |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 VERSION |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
version 0.72 |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 SYNOPSIS |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
my $logout_req = Net::SAML2::Protocol::LogoutRequest->new( |
162
|
|
|
|
|
|
|
issuer => $issuer, |
163
|
|
|
|
|
|
|
destination => $destination, |
164
|
|
|
|
|
|
|
nameid => $nameid, |
165
|
|
|
|
|
|
|
session => $session, |
166
|
|
|
|
|
|
|
); |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head1 METHODS |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 new( ... ) |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Constructor. Returns an instance of the LogoutRequest object. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Arguments: |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=over |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item B<session> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Session to log out |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item B<nameid> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
NameID of the user to log out |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item B<destination> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
IdP's identity URI this is required for a signed message but likely should be |
189
|
|
|
|
|
|
|
sent regardless |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=back |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
The following options alter the output of the NameID element |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=over |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item B<nameid_format> |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
When supplied adds the Format attribute to the NameID |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item B<sp_provided_id> |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
When supplied adds the SPProvidedID attribute to the NameID |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=item B<include_name_qualifier> |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Tell the module to include the NameQualifier and SPNameQualifier attributes in |
208
|
|
|
|
|
|
|
the NameID. Defaults to false unless the B<nameid_format> equals |
209
|
|
|
|
|
|
|
C<urn:oasis:names:tc:SAML:2.0:nameidformat:persistent> |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=item B<name_qualifier> |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
When supplied sets the NameQualifier attribute. When not supplied, this |
214
|
|
|
|
|
|
|
defaults to the destination. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item B<affiliation_group_id> |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
When supplied sets the SPNameQualifier attribute. When not supplied, this |
219
|
|
|
|
|
|
|
defaults to the issuer. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=back |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 new_from_xml( ... ) |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Create a LogoutRequest object from the given XML. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Arguments: |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=over |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=item B<xml> |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
XML data |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=back |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head2 as_xml( ) |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Returns the LogoutRequest as XML. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head1 AUTHORS |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=over 4 |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=item * |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Chris Andrews <chrisa@cpan.org> |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=item * |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
Timothy Legge <timlegge@gmail.com> |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=back |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
This software is copyright (c) 2023 by Venda Ltd, see the CONTRIBUTORS file for others. |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
260
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |