/usr/share/perl5/Authen/CAS/Client/Response.pm is in libauthen-cas-client-perl 0.07-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | require 5.006_001;
use strict;
use warnings;
#======================================================================
# Authen::CAS::Client::Response
#
package Authen::CAS::Client::Response;
our $VERSION = '0.03';
sub _ATTRIBUTES () { _ok => undef, doc => undef }
sub new {
my ( $class, %args ) = @_;
my %self = $class->_ATTRIBUTES;
for my $attribute ( keys %self ) {
$self{$attribute} = $args{$attribute}
if exists $args{$attribute};
}
bless \%self, $class
}
sub is_error { my ( $self ) = @_; ! defined $self->{_ok} }
sub is_failure { my ( $self ) = @_; defined $self->{_ok} && ! $self->{_ok} }
sub is_success { my ( $self ) = @_; defined $self->{_ok} && $self->{_ok} }
sub doc { my ( $self ) = @_; $self->{doc} }
#======================================================================
# Authen::CAS::Client::Response::Error
#
package Authen::CAS::Client::Response::Error;
use base qw/ Authen::CAS::Client::Response /;
sub _ATTRIBUTES () { error => 'An internal error occurred', $_[0]->SUPER::_ATTRIBUTES }
sub new { my $class = shift; $class->SUPER::new( @_, _ok => undef ) }
sub error { my ( $self ) = @_; $self->{error} }
#======================================================================
# Authen::CAS::Client::Response::Failure
#
package Authen::CAS::Client::Response::Failure;
use base qw/ Authen::CAS::Client::Response /;
sub _ATTRIBUTES () { code => undef, message => '', $_[0]->SUPER::_ATTRIBUTES }
sub new { my $class = shift; $class->SUPER::new( @_, _ok => 0 ) }
sub code { my ( $self ) = @_; $self->{code} }
sub message { my ( $self ) = @_; $self->{message} }
#======================================================================
# Authen::CAS::Client::Response::AuthFailure
#
package Authen::CAS::Client::Response::AuthFailure;
use base qw/ Authen::CAS::Client::Response::Failure /;
#======================================================================
# Authen::CAS::Client::Response::ProxyFailure
#
package Authen::CAS::Client::Response::ProxyFailure;
use base qw/ Authen::CAS::Client::Response::Failure /;
#======================================================================
# Authen::CAS::Client::Response::Success
#
package Authen::CAS::Client::Response::Success;
use base qw/ Authen::CAS::Client::Response /;
sub new { my $class = shift; $class->SUPER::new( @_, _ok => 1 ) }
#======================================================================
# Authen::CAS::Client::Response::AuthSuccess
#
package Authen::CAS::Client::Response::AuthSuccess;
use base qw/ Authen::CAS::Client::Response::Success /;
sub _ATTRIBUTES () { user => undef, iou => undef, proxies => [ ], $_[0]->SUPER::_ATTRIBUTES }
sub user { my ( $self ) = @_; $self->{user} }
sub iou { my ( $self ) = @_; $self->{iou} }
sub proxies { my ( $self ) = @_; wantarray ? @{ $self->{proxies} } : [ @{ $self->{proxies} } ] }
#======================================================================
# Authen::CAS::Client::Response::ProxySuccess
#
package Authen::CAS::Client::Response::ProxySuccess;
use base qw/ Authen::CAS::Client::Response::Success /;
sub _ATTRIBUTES () { proxy_ticket => undef, $_[0]->SUPER::_ATTRIBUTES }
sub proxy_ticket { my ( $self ) = @_; $self->{proxy_ticket} }
1
__END__
=pod
=head1 NAME
Authen::CAS::Client::Response - A set of classes for implementing
responses from a CAS server
=head1 DESCRIPTION
Authen::CAS::Client::Response implements a base class that is used to
build a hierarchy of response objects that are returned from methods in
L<Authen::CAS::Client>. Most response objects are meant to encapsulate
a type of response from a CAS server.
=head1 CLASSES AND METHODS
=head2 Authen::CAS::Client::Response
Authen::CAS::Client::Response is the base class from which all other
response classes inherit. As such it is very primitive and is never
used directly.
=head3 new( %args )
C<new()> creates an instance of an C<Authen::CAS::Client::Response> object
and assigns its data members according to the values in C<%args>.
=head3 is_error()
C<is_error()> returns true if the response represents an error object.
=head3 is_failure()
C<is_failure()> returns true if the response represents a failure object.
=head3 is_success()
C<is_success()> returns true if the response represents a success object.
=head3 doc()
C<doc()> returns the response document used to create the response object.
For errors and CAS v1.0 requests this will be the raw text response
from the server. Otherwise an L<XML::LibXML> object will be returned.
This can be used for debugging or retrieving additional information
from the CAS server's response.
=head2 Authen::CAS::Client::Response::Error
Authen::CAS::Client::Response::Error is used when an error occurs that
prevents further processing of a request. This would include not being able
connect to the CAS server, receiving an unexpected response from the server
or being unable to correctly parse the server's response according to the
guidelines in the CAS protocol specification.
=head3 new( error =E<gt> $error, doc =E<gt> $doc )
C<new()> creates an instance of an C<Authen::CAS::Client::Response::Error>
object. C<$error> is the error string. C<$doc> is the response document.
=head3 error()
C<error()> returns the error string.
=head2 Authen::CAS::Client::Response::Failure
Authen::CAS::Client::Response::Failure is used as a base class for other
failure responses. These correspond to the C<cas:authenticationFailure> and
C<cas:proxyFailure> server responses outlined in the CAS protocol
specification.
=head3 new( code =E<gt> $code, message =E<gt> $message, doc =E<gt> $doc )
C<new()> creates an instance of an C<Authen::CAS::Client::Response::Failure>
object. C<$code> is the failure code. C<$message> is the failure message.
C<$doc> is the response document.
=head3 code()
C<code()> returns the failure code.
=head3 message()
C<message()> returns the failure message.
=head2 Authen::CAS::Client::Response::AuthFailure
Authen::CAS::Client::Response::AuthFailure is a subclass of
C<Authen::CAS::Client::Response::Failure> and is used when a
validation attempt fails. When using the CAS v2.0 protocol,
C<$code>, C<$message> and C<$doc> are set according to what is parsed
from the server response. When using the CAS v1.0 protocol, C<$code>
is set to C<'V10_AUTH_FAILURE'>, C<$message> is set to the empty string
and C<$doc> is set to the server's response content.
No additional methods are defined.
=head2 Authen::CAS::Client::Response::ProxyFailure
Authen::CAS::Client::Response::ProxyFailure is a subclass of
C<Authen::CAS::Client::Response::Failure> and is used when a
C<cas:proxyFailure> response is received from the CAS server
during a proxy attempt. C<$code>, C<$message> and C<$doc> are set
according to what is parsed from the server response.
No additional methods are defined.
=head2 Authen::CAS::Client::Response::Success
C<Authen::CAS::Client::Response::Success> is used as base class for other
success responses. These correspond to the C<cas:authenticationSuccess> and
C<cas:proxySuccess> server responses.
=head3 new( doc =E<gt> $doc )
C<new()> creates an instance of an C<Authen::CAS::Client::Response::Success>
object. C<$doc> is the response document.
=head2 Authen::CAS::Client::Response::AuthSuccess
Authen::CAS::Client::Response::AuthSuccess is a subclass of
C<Authen::CAS::Client::Response::Success> and is used when
validation succeeds.
=head3 new( user =E<gt> $user, iou =E<gt> $iou, proxies =E<gt> \@proxies, doc =E<gt> $doc )
C<new()> creates an instance of an C<Authen::CAS::Client::Response::AuthSuccess>
object. C<$user> is the username received in the response. C<$iou>
is the proxy granting ticket IOU, if present. C<\@proxies> is the
list of proxies used during validation, if present. C<$doc> is the
response document.
=head3 user()
C<user()> returns the user name that was contained in the server response.
=head3 iou()
C<iou()> returns the proxy granting ticket IOU, if it was present in the
server response. Otherwise it is set to C<undef>.
=head3 proxies()
C<proxies()> returns the list of proxies present in the server response. If
no proxies are found, an empty list is returned. In scalar context an
array reference will be returned instead.
=head2 Authen::CAS::Client::Response::ProxySuccess
Authen::CAS::Client::Response::ProxySuccess is a subclass of
C<Authen::CAS::Client::Response::Success> and is used when a
C<cas:proxySuccess> response is received from the CAS server during
a proxy attempt.
=head3 new( proxy_ticket =E<gt> $proxy_ticket, doc =E<gt> $doc )
C<new()> creates an instance of an C<Authen::CAS::Client::Response::ProxySuccess>
object. C<$proxy_ticket> is the proxy ticket received in the response.
C<$doc> is the response document.
=head3 proxy_ticket()
C<proxy_ticket()> returns the proxy ticket that was contained in the
server response.
=head1 BUGS
None are known at this time, but if you find one, please feel free to
submit a report to the author.
=head1 AUTHOR
jason hord E<lt>pravus@cpan.orgE<gt>
=head1 SEE ALSO
=over 4
=item L<Authen::CAS::Client>
=back
=head1 COPYRIGHT
Copyright (c) 2007-2014, jason hord
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
=cut
|