1- use strict;
2- use warnings;
31package Net::SAML2::Protocol::LogoutResponse ;
42# VERSION
53
64use Moose;
75use MooseX::Types::URI qw/ Uri / ;
86use Net::SAML2::XML::Util qw/ no_comments / ;
7+ use Net::SAML2::Util qw/ deprecation_warning / ;
98use XML::LibXML::XPathContext;
109
1110with ' Net::SAML2::Role::ProtocolMessage' ;
@@ -18,12 +17,17 @@ Net::SAML2::Protocol::LogoutResponse - the SAML2 LogoutResponse object
1817
1918=head1 SYNOPSIS
2019
21- my $logout_req = Net::SAML2::Protocol::LogoutResponse->new(
22- issuer => $issuer,
23- destination => $destination,
24- status => $status,
25- response_to => $response_to,
26- );
20+ my $logout_req = Net::SAML2::Protocol::LogoutResponse->new(
21+ issuer => $issuer,
22+ destination => $destination,
23+ status => $status,
24+ response_to => $response_to,
25+ );
26+
27+ =head1 DESCRIPTION
28+
29+ This object deals with the LogoutResponse messages from SAML. It implements the
30+ role L<Net::SAML2::Role::ProtocolMessage> .
2731
2832=head1 METHODS
2933
@@ -37,27 +41,63 @@ Arguments:
3741
3842=item B<issuer >
3943
40- SP's identity URI
44+ SP's identity URI (required)
4145
4246=item B<destination >
4347
4448IdP's identity URI
4549
4650=item B<status >
4751
48- response status
52+ Response status (required)
53+
54+ =item B<sub_status >
4955
50- =item B< response_to >
56+ The sub status
5157
52- request ID we're responding to
58+ =item B<in_response_to >
59+
60+ Request ID we're responding to (required);
5361
5462=back
5563
5664=cut
5765
58- has ' status' => (isa => ' Str' , is => ' ro' , required => 1);
59- has ' substatus' => (isa => ' Str' , is => ' ro' , required => 0);
60- has ' response_to' => (isa => ' Str' , is => ' ro' , required => 1);
66+ has ' status' => (isa => ' Str' , is => ' ro' , required => 1);
67+ has ' sub_status' => (isa => ' Str' , is => ' ro' , required => 0);
68+ has ' +in_response_to' => (required => 1);
69+
70+ # Remove response_to/substatus after 6 months from now (april 18th 2024)
71+ around BUILDARGS => sub {
72+ my $orig = shift ;
73+ my $self = shift ;
74+ my %args = @_ ;
75+
76+ if (my $irt = delete $args {response_to }) {
77+ $args {in_response_to } = $irt ;
78+ deprecation_warning(
79+ " Please use in_response_to instead of response_to" );
80+ }
81+
82+ if (my $s = delete $args {substatus }) {
83+ $args {sub_status } = $s ;
84+ deprecation_warning(
85+ " Please use in_response_to instead of response_to" );
86+ }
87+ return $self -> $orig (%args );
88+ };
89+
90+ sub response_to {
91+ my $self = shift ;
92+ deprecation_warning(" Please use in_response_to instead of response_to" );
93+ return $self -> in_response_to;
94+ }
95+
96+ sub substatus {
97+ my $self = shift ;
98+ deprecation_warning(" Please use sub_status instead of substatus" );
99+ return $self -> sub_status;
100+ }
61101
62102=head2 new_from_xml( ... )
63103
@@ -86,12 +126,12 @@ sub new_from_xml {
86126
87127 my $self = $class -> new(
88128 id => $xpath -> findvalue(' /samlp:LogoutResponse/@ID' ),
89- response_to => $xpath -> findvalue(' /samlp:LogoutResponse/@InResponseTo' ),
129+ in_response_to => $xpath -> findvalue(' /samlp:LogoutResponse/@InResponseTo' ),
90130 destination => $xpath -> findvalue(' /samlp:LogoutResponse/@Destination' ),
91131 session => $xpath -> findvalue(' /samlp:LogoutResponse/samlp:SessionIndex' ),
92132 issuer => $xpath -> findvalue(' /samlp:LogoutResponse/saml:Issuer' ),
93133 status => $xpath -> findvalue(' /samlp:LogoutResponse/samlp:Status/samlp:StatusCode/@Value' ),
94- substatus => $xpath -> findvalue(' /samlp:LogoutResponse/samlp:Status/samlp:StatusCode/samlp:StatusCode/@Value' ),
134+ sub_status => $xpath -> findvalue(' /samlp:LogoutResponse/samlp:Status/samlp:StatusCode/samlp:StatusCode/@Value' ),
95135 );
96136
97137 return $self ;
@@ -117,7 +157,7 @@ sub as_xml {
117157 Version => ' 2.0' ,
118158 IssueInstant => $self -> issue_instant,
119159 Destination => $self -> destination,
120- InResponseTo => $self -> response_to },
160+ InResponseTo => $self -> in_response_to },
121161 $x -> Issuer(
122162 $saml ,
123163 $self -> issuer,
@@ -133,16 +173,10 @@ sub as_xml {
133173 );
134174}
135175
136- =head2 success( )
176+ __PACKAGE__ -> meta -> make_immutable;
137177
138- Returns true if the Response's status is Success.
178+ __END__
139179
140- =cut
180+ =head1 SEE ALSO
141181
142- sub success {
143- my ($self ) = @_ ;
144- return 1 if $self -> status eq $self -> status_uri(' success' );
145- return 0;
146- }
147-
148- __PACKAGE__ -> meta-> make_immutable;
182+ =head2 L<Net::SAML2::Roles::ProtocolMessage>
0 commit comments